Class FactorGrantedAuthority
java.lang.Object
org.springframework.security.core.authority.FactorGrantedAuthority
- All Implemented Interfaces:
Serializable,GrantedAuthority
A
GrantedAuthority specifically used for indicating the factor used at time of
authentication.- Since:
- 7.0
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe standardGrantedAuthority.getAuthority()that indicates that OAuth2 Authorization Code was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that bearer authentication was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that CAS was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that one time token was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that a password was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that SAML was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that WebAuthn was used to authenticate.static final StringThe standardGrantedAuthority.getAuthority()that indicates that X509 was used to authenticate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic FactorGrantedAuthorityfromAuthority(String authority) Shortcut forwithAuthority(authority).build().static FactorGrantedAuthorityfromFactor(String factor) Shortcut forwithFactor(factor).build().If theGrantedAuthoritycan be represented as aStringand thatStringis sufficient in precision to be relied upon for an access control decision by anAuthorizationManager(or delegate), this method should return such aString.Returns the instant when this authority was issued.inthashCode()toString()withAuthority(String authority) Creates a newFactorGrantedAuthority.Builderwith the specified authority.withFactor(String factor) Creates a newFactorGrantedAuthority.Builderwith the specified factor which is automatically prefixed with "FACTOR_".
-
Field Details
-
AUTHORIZATION_CODE_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that OAuth2 Authorization Code was used to authenticate.- See Also:
-
BEARER_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that bearer authentication was used to authenticate.- See Also:
-
CAS_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that CAS was used to authenticate.- See Also:
-
OTT_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that one time token was used to authenticate.- See Also:
-
PASSWORD_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that a password was used to authenticate.- See Also:
-
SAML_RESPONSE_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that SAML was used to authenticate.- See Also:
-
WEBAUTHN_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that WebAuthn was used to authenticate.- See Also:
-
X509_AUTHORITY
The standardGrantedAuthority.getAuthority()that indicates that X509 was used to authenticate.- See Also:
-
-
Method Details
-
withAuthority
Creates a newFactorGrantedAuthority.Builderwith the specified authority.- Parameters:
authority- the authority value (must not be null or empty)- Returns:
- a new
FactorGrantedAuthority.Builder
-
withFactor
Creates a newFactorGrantedAuthority.Builderwith the specified factor which is automatically prefixed with "FACTOR_".- Parameters:
factor- the factor value which is automatically prefixed with "FACTOR_" (must not be null or empty)- Returns:
- a new
FactorGrantedAuthority.Builder
-
fromAuthority
Shortcut forwithAuthority(authority).build().- Parameters:
authority- the authority value (must not be null or empty)- Returns:
- a new
FactorGrantedAuthority
-
fromFactor
Shortcut forwithFactor(factor).build().- Parameters:
factor- the factor value which is automatically prefixed with "FACTOR_" (must not be null or empty)- Returns:
- a new
FactorGrantedAuthority
-
getAuthority
Description copied from interface:GrantedAuthorityIf theGrantedAuthoritycan be represented as aStringand thatStringis sufficient in precision to be relied upon for an access control decision by anAuthorizationManager(or delegate), this method should return such aString.If the
GrantedAuthoritycannot be expressed with sufficient precision as aString,nullshould be returned. Returningnullwill require anAccessDecisionManager(or delegate) to specifically support theGrantedAuthorityimplementation, so returningnullshould be avoided unless actually required.- Specified by:
getAuthorityin interfaceGrantedAuthority- Returns:
- a representation of the granted authority (or
nullif the granted authority cannot be expressed as aStringwith sufficient precision).
-
getIssuedAt
Returns the instant when this authority was issued.- Returns:
- the issued-at instant
-
equals
-
hashCode
public int hashCode() -
toString
-