1
0
mirror of https://github.com/google/nomulus synced 2026-01-03 11:45:39 +00:00

Extend registrar allowed IPs auth exception text with IP address (#1726)

This commit is contained in:
Pavlo Tkach
2022-08-03 15:24:00 -04:00
committed by GitHub
parent c903ed4c13
commit ad06ba2e1e

View File

@@ -114,7 +114,7 @@ public class TlsCredentials implements TransportCredentials {
"Authentication error: IP address %s is not allow-listed for registrar %s; allow list is:"
+ " %s",
clientInetAddr, registrar.getRegistrarId(), ipAddressAllowList);
throw new BadRegistrarIpAddressException();
throw new BadRegistrarIpAddressException(clientInetAddr);
}
@VisibleForTesting
@@ -216,8 +216,12 @@ public class TlsCredentials implements TransportCredentials {
/** Registrar IP address is not in stored allow list. */
public static class BadRegistrarIpAddressException extends AuthenticationErrorException {
BadRegistrarIpAddressException() {
super("Registrar IP address is not in stored allow list");
BadRegistrarIpAddressException(Optional<InetAddress> clientInetAddr) {
super(
clientInetAddr.isPresent()
? String.format(
"Registrar IP address %s is not in stored allow list", clientInetAddr.get())
: "Registrar IP address is not in stored allow list");
}
}