1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Add GrantedAuthorities.FACTOR_*_AUTHORITY

Closes gh-17952
This commit is contained in:
Rob Winch
2025-09-24 08:42:43 -05:00
parent 28aad8855c
commit b2d76dfe66
57 changed files with 227 additions and 81 deletions
@@ -58,6 +58,7 @@ import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthorities;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
@@ -113,7 +114,7 @@ import org.springframework.util.StringUtils;
*/
public final class OpenSaml5AuthenticationProvider implements AuthenticationProvider {
private static final String AUTHORITY = "FACTOR_SAML_RESPONSE";
private static final String AUTHORITY = GrantedAuthorities.FACTOR_SAML_RESPONSE_AUTHORITY;
private final BaseOpenSamlAuthenticationProvider delegate;
@@ -73,6 +73,7 @@ import org.opensaml.xmlsec.signature.support.SignatureConstants;
import org.springframework.core.convert.converter.Converter;
import org.springframework.security.authentication.SecurityAssertions;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthorities;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.jackson2.SecurityJackson2Modules;
@@ -990,7 +991,7 @@ public class OpenSaml5AuthenticationProviderTests {
Response response = TestOpenSamlObjects.signedResponseWithOneAssertion();
Authentication request = token(response, verifying(registration()));
Authentication result = this.provider.authenticate(request);
SecurityAssertions.assertThat(result).hasAuthority("FACTOR_SAML_RESPONSE");
SecurityAssertions.assertThat(result).hasAuthority(GrantedAuthorities.FACTOR_SAML_RESPONSE_AUTHORITY);
}
private <T extends XMLObject> T build(QName qName) {