use of org.apache.geode.internal.security.shiro.GeodeAuthenticationToken in project geode by apache.
the class IntegratedSecurityService method login.
/**
* @return null if security is not enabled, otherwise return a shiro subject
*/
public Subject login(Properties credentials) {
if (!isIntegratedSecurity()) {
return null;
}
if (credentials == null)
return null;
// this makes sure it starts with a clean user object
ThreadContext.remove();
Subject currentUser = SecurityUtils.getSubject();
GeodeAuthenticationToken token = new GeodeAuthenticationToken(credentials);
try {
logger.debug("Logging in " + token.getPrincipal());
currentUser.login(token);
} catch (ShiroException e) {
logger.info(e.getMessage(), e);
throw new AuthenticationFailedException("Authentication error. Please check your credentials.", e);
}
return currentUser;
}
Aggregations