* @see org.springframework.security.web.context.SecurityContextRepository#loadContext(org.springframework.security.web.context.HttpRequestResponseHolder)
*/
@Override
public SecurityContext loadContext(final HttpRequestResponseHolder requestResponseHolder) {
final HttpServletRequest request = requestResponseHolder.getRequest();
final SecurityContextImpl securityContext = new SecurityContextImpl();
final String username = getLoginUser(request);
if (present(username)) {
/*
* user name found in session -> get the corresponding user
*/
final UserDetails user = this.service.loadUserByUsername(username);
final Authentication authentication = new SessionAuthenticationToken(user, user.getAuthorities());
securityContext.setAuthentication(authentication);
}
return securityContext;
}