Search in sources :

Example 1 with DefaultSamlAuthentication

use of org.springframework.security.saml.spi.DefaultSamlAuthentication in project service-authorization by reportportal.

the class ReportPortalSamlAuthenticationManager method authenticate.

@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    if (authentication instanceof DefaultSamlAuthentication) {
        ReportPortalSamlAuthentication reportPortalSamlAuthentication = new ReportPortalSamlAuthentication((DefaultSamlAuthentication) authentication);
        if (reportPortalSamlAuthentication.isAuthenticated()) {
            User user = samlUserReplicator.replicateUser(reportPortalSamlAuthentication);
            reportPortalSamlAuthentication.setAuthorities(AuthUtils.AS_AUTHORITIES.apply(user.getRole()));
            SecurityContextHolder.getContext().setAuthentication(reportPortalSamlAuthentication);
        }
        return reportPortalSamlAuthentication;
    }
    return authentication;
}
Also used : DefaultSamlAuthentication(org.springframework.security.saml.spi.DefaultSamlAuthentication) User(com.epam.ta.reportportal.entity.user.User)

Aggregations

User (com.epam.ta.reportportal.entity.user.User)1 DefaultSamlAuthentication (org.springframework.security.saml.spi.DefaultSamlAuthentication)1