forked from TuxCoding/FastLogin
Remove local address check (Related #181)
This commit is contained in:
@ -136,7 +136,7 @@ public class AuthStorage {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean save(PlayerProfile playerProfile) {
|
||||
public void save(PlayerProfile playerProfile) {
|
||||
try (Connection con = dataSource.getConnection()) {
|
||||
UUID uuid = playerProfile.getUuid();
|
||||
|
||||
@ -177,12 +177,10 @@ public class AuthStorage {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (SQLException ex) {
|
||||
core.getPlugin().getLog().error("Failed to save playerProfile", ex);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
|
@ -152,26 +152,21 @@ public class MojangApiConnector {
|
||||
return getConnection(url, Proxy.NO_PROXY);
|
||||
}
|
||||
|
||||
private SSLSocketFactory buildAddresses(Logger logger, Collection<String> localAddresses) {
|
||||
if (localAddresses.isEmpty()) {
|
||||
return HttpsURLConnection.getDefaultSSLSocketFactory();
|
||||
}
|
||||
|
||||
private SSLSocketFactory buildAddresses(Logger logger, Iterable<String> localAddresses) {
|
||||
Set<InetAddress> addresses = Sets.newHashSet();
|
||||
for (String localAddress : localAddresses) {
|
||||
try {
|
||||
InetAddress address = InetAddress.getByName(localAddress.replace('-', '.'));
|
||||
if (!address.isAnyLocalAddress()) {
|
||||
logger.warn("Submitted IP-Address is not local {}", address);
|
||||
continue;
|
||||
}
|
||||
|
||||
addresses.add(address);
|
||||
} catch (UnknownHostException ex) {
|
||||
logger.error("IP-Address is unknown to us", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (addresses.isEmpty()) {
|
||||
return HttpsURLConnection.getDefaultSSLSocketFactory();
|
||||
}
|
||||
|
||||
return new BalancedSSLFactory(HttpsURLConnection.getDefaultSSLSocketFactory(), addresses);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user