use of org.graylog2.shared.security.AccessTokenAuthToken in project graylog2-server by Graylog2.
the class AccessTokenAuthenticator method doGetAuthenticationInfo.
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
AccessTokenAuthToken authToken = (AccessTokenAuthToken) token;
final AccessToken accessToken = accessTokenService.load(String.valueOf(authToken.getToken()));
if (accessToken == null) {
return null;
}
final User user = userService.load(accessToken.getUserName());
if (user == null) {
return null;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Found user {} for access token.", user);
}
try {
accessTokenService.touch(accessToken);
} catch (ValidationException e) {
LOG.warn("Unable to update access token's last access date.", e);
}
ShiroSecurityContext.requestSessionCreation(false);
return new SimpleAccount(user.getName(), null, "access token realm");
}
Aggregations