use of com.autentia.tnt.manager.security.AuthenticationManager in project TNTConcept by autentia.
the class SpringUtilsForTesting method loadPrincipalInSecurityContext.
public static void loadPrincipalInSecurityContext(String username) {
AuthenticationManager authManager = (AuthenticationManager) getSpringBean("userDetailsService");
Principal principal = (Principal) authManager.loadUserByUsername(username);
Authentication auth = new UsernamePasswordAuthenticationToken(principal, principal.getUser().getPassword(), principal.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(auth);
}
Aggregations