Class AuthenticationAttributes
Object
se.curity.identityserver.sdk.attribute.Attributes
se.curity.identityserver.sdk.attribute.AuthenticationAttributes
- All Implemented Interfaces:
Iterable<Attribute>,AttributeContainer<Attributes>,SerializableAsMap
Subtype of Attributes that contains.
- A Subject-value
- A set (Attributes) of Subject-related attributes
- A set (Attributes) of Context-related attributes
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAuthenticationAttributes(SubjectAttributes subjectAttributes, ContextAttributes contextAttributes) protectedAuthenticationAttributes(SubjectAttributes subjectAttributes, ContextAttributes contextAttributes, Attribute additionalAttribute) -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthenticationAttributesfromAttributes(Attributes other) Create a new AuthenticationAttributes instance from the provided Attributes, that actually represents an Attributes-instance with the correct structure.longlongstatic AuthenticationAttributesof(String subject, ContextAttributes contextAttributes) static AuthenticationAttributesof(Attribute subjectAttribute, ContextAttributes contextAttributes) static AuthenticationAttributesof(SubjectAttributes subjectAttributes, ContextAttributes contextAttributes) withAdditionalFactor(AuthenticationAttributes secondFactor, String secondFactorAcr) Returns a newAuthenticationAttributeswith the second factor authentication attributes added.withContextAttribute(Attribute attribute) Augments theContextAttributesof the currentAuthenticationAttributeswith the givenAttributeand returns the amalgamation.withContextAttribute(AuthenticationSessionAttribute authenticationSessionAttribute) Recalculate the AuthenticationAttributes for the given ServiceProvider.withSubjectAttribute(Attribute attribute) Augments theSubjectAttributesof the currentAuthenticationAttributeswith the givenAttributeand returns the amalgamation.Methods inherited from class se.curity.identityserver.sdk.attribute.Attributes
append, append, asMap, contains, empty, equals, fromMap, fromMap, get, getAll, getMandatoryAttribute, getMandatoryValue, getValuesOfType, hashCode, isEmpty, iterator, keys, of, of, of, of, of, of, of, removeAttributes, retainAttributes, size, stream, toMap, toString, with, withMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface se.curity.identityserver.sdk.attribute.AttributeContainer
contains, getOptionalValue, getOptionalValue, removeAttribute, retainAttributeMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
SUBJECT_ATTRIBUTES
- See Also:
-
CONTEXT_ATTRIBUTES
- See Also:
-
-
Constructor Details
-
AuthenticationAttributes
protected AuthenticationAttributes(SubjectAttributes subjectAttributes, ContextAttributes contextAttributes) -
AuthenticationAttributes
protected AuthenticationAttributes(SubjectAttributes subjectAttributes, ContextAttributes contextAttributes, Attribute additionalAttribute)
-
-
Method Details
-
of
public static AuthenticationAttributes of(Attribute subjectAttribute, ContextAttributes contextAttributes) -
of
-
of
public static AuthenticationAttributes of(SubjectAttributes subjectAttributes, ContextAttributes contextAttributes) -
fromAttributes
public static AuthenticationAttributes fromAttributes(Attributes other) throws AttributeValueException Create a new AuthenticationAttributes instance from the provided Attributes, that actually represents an Attributes-instance with the correct structure.This method should be called when an Attributes-instance is deserialized and needs to be upcast to AuthenticationAttributes.
- Parameters:
other- Attributes-instance that has the correct model to be upcast as AuthenticationAttributes- Returns:
- the AuthenticationAttributes instance that is represented by the provided Attributes
- Throws:
AttributeValueException- when provided attributes did not contain required subject- and/or context- attributes.
-
withContextAttribute
Augments theContextAttributesof the currentAuthenticationAttributeswith the givenAttributeand returns the amalgamation.- Parameters:
attribute- the attribute to be included in theContextAttributesset which thisAuthenticationAttributesset- Returns:
- this
AuthenticationAttributesset together with the givenAttributein theContextAttributes - See Also:
-
withSubjectAttribute
Augments theSubjectAttributesof the currentAuthenticationAttributeswith the givenAttributeand returns the amalgamation. NOTE: This method, like all with methods is pure, and has no side effects that affect the object on which this method is called. Therefore, the result should always be used in some manner.- Parameters:
attribute- the attribute to be included in theSubjectAttributesset which thisAuthenticationAttributesset- Returns:
- this
AuthenticationAttributesset together with the givenAttributein theSubjectAttributes - Since:
- 5.1.0
- See Also:
-
getSubject
-
getAuthTime
public long getAuthTime() -
getExpiresAt
public long getExpiresAt() -
getSubjectAttributes
-
getContextAttributes
-
withAdditionalFactor
public AuthenticationAttributes withAdditionalFactor(AuthenticationAttributes secondFactor, String secondFactorAcr) Returns a newAuthenticationAttributeswith the second factor authentication attributes added.The resulting attributes are created using the following algorithm:
- First, each one of second factor attributes is added, using the
secondFactorAcras the authority. If the additional factor attribute already has an authority, then it is kept. - Then, each one of the current attributes is added. This ensures that on any collision (i.e. attributes with the same name and authority), the current attributes win.
- Parameters:
secondFactor- theAuthenticationAttributesproduced by the second factor.secondFactorAcr- the ACR (Authentication Class Context Reference) for the second factor authenticator.- Returns:
- the
AuthenticationAttributescombining this attributes and the second factor attributes.
- First, each one of second factor attributes is added, using the
-
withContextAttribute
public AuthenticationAttributes withContextAttribute(AuthenticationSessionAttribute authenticationSessionAttribute) Recalculate the AuthenticationAttributes for the given ServiceProvider. This will update ServiceProvider specific attributes of the ContextAttributes and return a new instance. Existing ServiceProvider specific attributes, if any, will be overwritten. In case the AuthenticationAttributes were already bound to the provided ServiceProvider, no new attributes are added or created.- Parameters:
authenticationSessionAttribute- theAuthenticationSessionAttributeto add to the context- Returns:
- new AuthenticationAttributes instance bound to the provided ServiceProvider
- Since:
- 5.1.0
-