Package org.apereo.cas.authentication
Interface AuthenticationBuilder
- All Superinterfaces:
Serializable
Constructs immutable
Authentication objects using the builder pattern.- Since:
- 4.1.0
-
Method Summary
Modifier and TypeMethodDescriptionaddAttribute(String key, Object value) Adds an authentication metadata attribute key-value pair.addAttribute(String key, List<Object> value) Adds an authentication metadata attribute key-value pair.addAttributes(Map<String, Object> attributes) Add attributes.addCredential(Credential credential) Adds metadata about a credential presented for authentication.addCredentials(List<Credential> credentials) Add credentials authentication builder.addFailure(String key, Throwable value) Adds an authentication failure to the map of handler names to the authentication handler failures.addFailures(Map<String, Throwable> failures) Adds failures.addSuccess(String key, AuthenticationHandlerExecutionResult value) Adds an authentication success to the map of handler names to successful authentication handler results.addSuccesses(Map<String, AuthenticationHandlerExecutionResult> successes) Adds successes authentication builder.addWarning(MessageDescriptor warning) Add warning to authentication builder.addWarnings(List<MessageDescriptor> warning) Add warnings to authentication builder.build()Creates an immutable authentication instance from builder data.Retrieve the authentication date/time as indicated by this builder.Gets the authentication failure map.Gets the authenticated principal.Gets the authentication success map.default booleanhasAttribute(String name) Has attribute boolean.booleanhasAttribute(String name, Predicate<Object> value) Has attribute boolean.mergeAttribute(String key, Object value) Merge attribute.mergeAttribute(String key, List<Object> value) Merge attribute.default AuthenticationBuildermergeAttributes(Map<String, List<Object>> toMerge) Merge attribute.setAttributes(Map<String, List<Object>> attributes) Sets the authentication metadata attributes.Sets the authentication date and returns this instance.setFailures(Map<String, Throwable> failures) Sets failures.Sets the principal returns this instance.setSuccesses(Map<String, AuthenticationHandlerExecutionResult> successes) Set successes authentication builder.setWarnings(List<MessageDescriptor> warning) Set warning to authentication builder.
-
Method Details
-
getPrincipal
Principal getPrincipal()Gets the authenticated principal.- Returns:
- Principal. principal
-
setPrincipal
Sets the principal returns this instance.- Parameters:
p- Authenticated principal.- Returns:
- This builder instance.
-
addCredentials
Add credentials authentication builder.- Parameters:
credentials- the credentials- Returns:
- the authentication builder
- Since:
- 4.2.0
-
addCredential
Adds metadata about a credential presented for authentication.- Parameters:
credential- Credential metadata.- Returns:
- This builder instance.
-
addWarnings
Add warnings to authentication builder.- Parameters:
warning- the warning- Returns:
- the authentication builder
-
addWarning
Add warning to authentication builder.- Parameters:
warning- the warning- Returns:
- the authentication builder
-
setWarnings
Set warning to authentication builder.- Parameters:
warning- the warning- Returns:
- the authentication builder
-
addAttribute
Adds an authentication metadata attribute key-value pair.- Parameters:
key- Authentication attribute key.value- Authentication attribute value.- Returns:
- This builder instance.
-
addAttribute
Adds an authentication metadata attribute key-value pair.- Parameters:
key- Authentication attribute key.value- Authentication attribute value.- Returns:
- This builder instance.
-
addAttributes
Add attributes.- Parameters:
attributes- the attributes- Returns:
- the authentication builder
-
getSuccesses
Map<String,AuthenticationHandlerExecutionResult> getSuccesses()Gets the authentication success map.- Returns:
- Non -null map of handler names to successful handler authentication results.
-
setSuccesses
Set successes authentication builder.- Parameters:
successes- the successes- Returns:
- the authentication builder
- Since:
- 4.2.0
-
addSuccesses
Adds successes authentication builder.- Parameters:
successes- the successes- Returns:
- the authentication builder
- Since:
- 4.2.0
-
addFailures
Adds failures.- Parameters:
failures- the failures- Returns:
- the failures
- Since:
- 4.2.0
-
addSuccess
Adds an authentication success to the map of handler names to successful authentication handler results.- Parameters:
key- Authentication handler name.value- Successful authentication handler result produced by handler of given name.- Returns:
- This builder instance.
-
build
Authentication build()Creates an immutable authentication instance from builder data.- Returns:
- Immutable authentication.
-
getFailures
Gets the authentication failure map.- Returns:
- Non -null authentication failure map.
-
setFailures
Sets failures.- Parameters:
failures- the failures- Returns:
- the failures
-
addFailure
Adds an authentication failure to the map of handler names to the authentication handler failures.- Parameters:
key- Authentication handler name.value- Exception raised on handler failure to authenticate credential.- Returns:
- This builder instance.
-
setAttributes
Sets the authentication metadata attributes.- Parameters:
attributes- Non-null map of authentication metadata attributes.- Returns:
- This builder instance.
-
mergeAttributes
@CanIgnoreReturnValue default AuthenticationBuilder mergeAttributes(Map<String, List<Object>> toMerge) Merge attribute.- Parameters:
toMerge- the to merge- Returns:
- the authentication builder
-
mergeAttribute
Merge attribute.- Parameters:
key- the keyvalue- the value- Returns:
- the authentication builder
-
mergeAttribute
Merge attribute.- Parameters:
key- the keyvalue- the value- Returns:
- the authentication builder
-
getAuthenticationDate
ZonedDateTime getAuthenticationDate()Retrieve the authentication date/time as indicated by this builder.- Returns:
- authn date/time
-
setAuthenticationDate
Sets the authentication date and returns this instance.- Parameters:
d- Authentication date.- Returns:
- This builder instance.
-
hasAttribute
Has attribute boolean.- Parameters:
name- the namevalue- the value- Returns:
- true /false
-
hasAttribute
Has attribute boolean.- Parameters:
name- the name- Returns:
- true/false
-