use of org.apache.shiro.ShiroException in project geode by apache.
the class IntegratedSecurityService method logout.
public void logout() {
Subject currentUser = getSubject();
if (currentUser == null) {
return;
}
try {
logger.debug("Logging out " + currentUser.getPrincipal());
currentUser.logout();
} catch (ShiroException e) {
logger.info(e.getMessage(), e);
throw new GemFireSecurityException(e.getMessage(), e);
}
// clean out Shiro's thread local content
ThreadContext.remove();
}
use of org.apache.shiro.ShiroException 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