1
0
mirror of synced 2026-05-22 13:23:17 +00:00

Authentication adds FactorGrantedAuthority

Closes gh-18001
This commit is contained in:
Rob Winch
2025-10-02 09:33:13 -05:00
parent ce36fc1e76
commit 3f74991ce9
9 changed files with 20 additions and 22 deletions
@@ -39,7 +39,7 @@ import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthorities;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.authority.FactorGrantedAuthority;
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
import org.springframework.security.core.userdetails.UserCache;
@@ -207,7 +207,7 @@ public abstract class AbstractUserDetailsAuthenticationProvider
// authentication events after cache expiry contain the details
Collection<GrantedAuthority> authorities = new LinkedHashSet<>(
this.authoritiesMapper.mapAuthorities(user.getAuthorities()));
authorities.add(new SimpleGrantedAuthority(AUTHORITY));
authorities.add(FactorGrantedAuthority.fromAuthority(AUTHORITY));
UsernamePasswordAuthenticationToken result = UsernamePasswordAuthenticationToken.authenticated(principal,
authentication.getCredentials(), authorities);
result.setDetails(authentication.getDetails());