mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 23:12:06 -03:30
Avoid NPE when checking exceptions for password based Kerberos login
Closes #36061 Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
4669cfe9cb
commit
180be7b182
@ -102,6 +102,7 @@ public class KerberosUsernamePasswordAuthenticator {
|
||||
}
|
||||
|
||||
protected void checkKerberosServerAvailable(LoginException le) {
|
||||
if (le.getMessage() != null) {
|
||||
String message = le.getMessage().toUpperCase();
|
||||
if (message.contains("PORT UNREACHABLE") ||
|
||||
message.contains("CANNOT LOCATE") ||
|
||||
@ -111,14 +112,20 @@ public class KerberosUsernamePasswordAuthenticator {
|
||||
message.contains("RECEIVE TIMED OUT")) {
|
||||
throw new ModelException("Kerberos unreachable", le);
|
||||
}
|
||||
} else if (le.getCause() instanceof IOException) {
|
||||
// for example, a PortUnreachable exception if the server is not running
|
||||
throw new ModelException("Kerberos unreachable", le);
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkKerberosUsername(LoginException le) {
|
||||
if (le.getMessage() != null) {
|
||||
String message = le.getMessage();
|
||||
if (message.contains("IllegalArgumentException")) {
|
||||
throw new ModelException("Kerberos illegal username", le);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user