Search in sources :

Example 1 with JwtAuthenticationToken

use of com.epam.pipeline.security.jwt.JwtAuthenticationToken in project cloud-pipeline by epam.

the class AuthManager method createSchedulerSecurityContext.

/**
 * @return A default UserContext for scheduled operations
 */
public SecurityContext createSchedulerSecurityContext() {
    SecurityContext context = SecurityContextHolder.createEmptyContext();
    UserContext userContext = new UserContext(defaultAdminId, defaultAdmin);
    Collection<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList("ROLE_ADMIN");
    context.setAuthentication(new JwtAuthenticationToken(userContext, authorities));
    return context;
}
Also used : JwtAuthenticationToken(com.epam.pipeline.security.jwt.JwtAuthenticationToken) UserContext(com.epam.pipeline.security.UserContext) GrantedAuthority(org.springframework.security.core.GrantedAuthority) SecurityContext(org.springframework.security.core.context.SecurityContext)

Aggregations

UserContext (com.epam.pipeline.security.UserContext)1 JwtAuthenticationToken (com.epam.pipeline.security.jwt.JwtAuthenticationToken)1 GrantedAuthority (org.springframework.security.core.GrantedAuthority)1 SecurityContext (org.springframework.security.core.context.SecurityContext)1