Package org.apereo.cas.authentication
Interface Authentication
- All Superinterfaces:
Serializable
The Authentication object represents a successful authentication request. It contains the principal that the authentication request was made for as well as the additional meta information such as the authenticated date and a map of attributes.
An Authentication object must be serializable to permit persistence and clustering.
Implementing classes must take care to ensure that the Map returned by getAttributes is serializable by using a Serializable map such as HashMap.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, Object value) Add attribute to the authentication object and update the instance.booleancontainsAttribute(String name) Contains attribute?Attributes of the authentication (not the Principal).Method to retrieve the timestamp of when this Authentication object was created.Gets a list of metadata about the credentials supplied at authentication time.Gets a map describing failed authentications.Method to obtain the Principal.default ObjectGets single valued attribute.<T> TgetSingleValuedAttribute(String name, Class<T> expectedType) Gets attribute.Gets a map describing successful authentications produced byAuthenticationHandlercomponents.Get a list of authentication warnings that may be considered global and applicable to the entire authentication event.booleanisEqualTo(Authentication auth2) Determines if two authentication objects are effectively the same attempt by comparing key aspects/fields of each attempt.voidreplaceAttributes(Authentication authn) Updates the authentication object with what's passed.voidupdateAttributes(Authentication authn) Updates the authentication object with what's passed.
-
Method Details
-
getPrincipal
Principal getPrincipal()Method to obtain the Principal.- Returns:
- a Principal implementation
-
getAuthenticationDate
ZonedDateTime getAuthenticationDate()Method to retrieve the timestamp of when this Authentication object was created.- Returns:
- the date/time the authentication occurred.
-
getAttributes
Attributes of the authentication (not the Principal).- Returns:
- the map of attributes.
-
addAttribute
Add attribute to the authentication object and update the instance.- Parameters:
name- the namevalue- the value
-
containsAttribute
Contains attribute?- Parameters:
name- the name- Returns:
- true
-
getCredentials
List<Credential> getCredentials()Gets a list of metadata about the credentials supplied at authentication time.- Returns:
- Non -null list of supplied credentials represented as metadata that should be considered safe for long-term storage (e.g. serializable and secure with respect to credential disclosure). The order of items in the returned list SHOULD be the same as the order in which the source credentials were presented and subsequently processed.
-
getWarnings
List<MessageDescriptor> getWarnings()Get a list of authentication warnings that may be considered global and applicable to the entire authentication event.- Returns:
- list of authentication attempts.
-
getSuccesses
Map<String,AuthenticationHandlerExecutionResult> getSuccesses()Gets a map describing successful authentications produced byAuthenticationHandlercomponents.- Returns:
- Map of handler names to successful authentication result produced by that handler.
-
getFailures
Gets a map describing failed authentications. By definition the failures here were not sufficient to prevent authentication.- Returns:
- Map of authentication handler names to the authentication errors produced on attempted authentication.
-
updateAttributes
Updates the authentication object with what's passed. Does not override current keys if there are clashes- Parameters:
authn- the authn object
-
replaceAttributes
Updates the authentication object with what's passed. Does override current keys if there are clashes. Clears the existing attributes and starts over.- Parameters:
authn- the authn object
-
isEqualTo
Determines if two authentication objects are effectively the same attempt by comparing key aspects/fields of each attempt. This is not pure object equality; equality here may eventually determine if an SSO session should be renewed, or if the newer attempt is so very different from the current, that the current SSO session should be destroyed first.- Parameters:
auth2- the second auth- Returns:
- true/false
-
getSingleValuedAttribute
Gets attribute.- Type Parameters:
T- the type parameter- Parameters:
name- the nameexpectedType- the expected type- Returns:
- the attribute
-
getSingleValuedAttribute
Gets single valued attribute.- Parameters:
name- the name- Returns:
- the single valued attribute
-