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