Minor improvements for kerberos
This commit is contained in:
parent
0e0181ced4
commit
c2f2c5ccb6
2 changed files with 6 additions and 4 deletions
|
@ -115,12 +115,14 @@ public class KerberosUsernamePasswordAuthenticator {
|
||||||
protected String getKerberosPrincipal(String username) throws LoginException {
|
protected String getKerberosPrincipal(String username) throws LoginException {
|
||||||
if (username.contains("@")) {
|
if (username.contains("@")) {
|
||||||
String[] tokens = username.split("@");
|
String[] tokens = username.split("@");
|
||||||
username = tokens[0];
|
|
||||||
String kerberosRealm = tokens[1];
|
String kerberosRealm = tokens[1];
|
||||||
if (kerberosRealm.toUpperCase().equals(config.getKerberosRealm())) {
|
if (!kerberosRealm.toUpperCase().equals(config.getKerberosRealm())) {
|
||||||
logger.warn("Invalid kerberos realm. Expected realm: " + config.getKerberosRealm() + ", username: " + username);
|
logger.warn("Invalid kerberos realm. Expected realm: " + config.getKerberosRealm() + ", username: " + username);
|
||||||
throw new LoginException("Invalid kerberos realm");
|
throw new LoginException("Client not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
username = tokens[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return username + "@" + config.getKerberosRealm();
|
return username + "@" + config.getKerberosRealm();
|
||||||
|
|
|
@ -372,7 +372,7 @@ public class UserFederationManager implements UserProvider {
|
||||||
for (UserCredentialModel cred : input) {
|
for (UserCredentialModel cred : input) {
|
||||||
UserFederationProvider providerSupportingCreds = null;
|
UserFederationProvider providerSupportingCreds = null;
|
||||||
|
|
||||||
// Find provider, which supports required credential type
|
// Find first provider, which supports required credential type
|
||||||
for (UserFederationProvider fedProvider : fedProviders) {
|
for (UserFederationProvider fedProvider : fedProviders) {
|
||||||
if (fedProvider.getSupportedCredentialTypes().contains(cred.getType())) {
|
if (fedProvider.getSupportedCredentialTypes().contains(cred.getType())) {
|
||||||
providerSupportingCreds = fedProvider;
|
providerSupportingCreds = fedProvider;
|
||||||
|
|
Loading…
Reference in a new issue