INNER CODE UNIT · Java
saveAll
pac4j/spring-security-pac4j · src/main/java/org/pac4j/springframework/security/profile/SpringSecurityProfileManager.java:30
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);
}
}
}
@Override
public void removeProfiles() {
super.removeProfiles();