INNER CODE UNIT · Java

SpringSecurityProfileManager

pac4j/spring-security-pac4j · src/main/java/org/pac4j/springframework/security/profile/SpringSecurityProfileManager.java:23

public class SpringSecurityProfileManager extends ProfileManager {

    public SpringSecurityProfileManager(final WebContext context, final SessionStore sessionStore) {
        super(context, sessionStore);
    }

    @Override
    protected void saveAll(LinkedHashMap<String, UserProfile> profiles, final boolean saveInSession) {
        super.saveAll(profiles, saveInSession);

        final Optional<Authentication> authentication = SpringSecurityHelper.computeAuthentication(profiles);
        if (authentication.isPresent()) {
            final SecurityContext securityContext = new SecurityContextImpl(authentication.get());
            SecurityContextHolder.setContext(securityContext);
            if (saveInSession) {
                sessionStore.set(context, WebSessionServerSecurityContextRepository.DEFAULT_SPRING_SECURITY_CONTEXT_ATTR_NAME,
                        securityContext);
            }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…