use of org.apache.syncope.core.spring.security.SyncopeAuthenticationDetails in project syncope by apache.
the class ResourceDataBinderTest method setAuthContext.
@BeforeAll
public static void setAuthContext() {
List<GrantedAuthority> authorities = StandardEntitlement.values().stream().map(entitlement -> new SyncopeGrantedAuthority(entitlement, SyncopeConstants.ROOT_REALM)).collect(Collectors.toList());
UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(new org.springframework.security.core.userdetails.User("admin", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
auth.setDetails(new SyncopeAuthenticationDetails("Master"));
SecurityContextHolder.getContext().setAuthentication(auth);
}
Aggregations