use of org.apache.geode.security.Authenticator in project geode by apache.
the class HandShake method verifyCredentials.
/**
* this could return either a Subject or a Principal depending on if it's integrated security or
* not
*/
public static Object verifyCredentials(String authenticatorMethod, Properties credentials, Properties securityProperties, InternalLogWriter logWriter, InternalLogWriter securityLogWriter, DistributedMember member) throws AuthenticationRequiredException, AuthenticationFailedException {
if (!AcceptorImpl.isAuthenticationRequired()) {
return null;
}
Authenticator auth = null;
try {
if (AcceptorImpl.isIntegratedSecurity()) {
return securityService.login(credentials);
} else {
Method instanceGetter = ClassLoadUtil.methodFromName(authenticatorMethod);
auth = (Authenticator) instanceGetter.invoke(null, (Object[]) null);
auth.init(securityProperties, logWriter, securityLogWriter);
return auth.authenticate(credentials, member);
}
} catch (AuthenticationFailedException ex) {
throw ex;
} catch (Exception ex) {
throw new AuthenticationFailedException(ex.getMessage(), ex);
} finally {
if (auth != null)
auth.close();
}
}
Aggregations