Package org.apereo.cas.authentication
Interface AuthenticationBuilder
-
- All Superinterfaces:
java.io.Serializable
public interface AuthenticationBuilder extends java.io.SerializableConstructs immutableAuthenticationobjects using the builder pattern.- Since:
- 4.1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description AuthenticationBuilderaddAttribute(java.lang.String key, java.lang.Object value)Adds an authentication metadata attribute key-value pair.AuthenticationBuilderaddAttribute(java.lang.String key, java.util.List<java.lang.Object> value)Adds an authentication metadata attribute key-value pair.AuthenticationBuilderaddCredential(CredentialMetaData credential)Adds metadata about a credential presented for authentication.AuthenticationBuilderaddCredentials(java.util.List<CredentialMetaData> credentials)Add credentials authentication builder.AuthenticationBuilderaddFailure(java.lang.String key, java.lang.Throwable value)Adds an authentication failure to the map of handler names to the authentication handler failures.AuthenticationBuilderaddFailures(java.util.Map<java.lang.String,java.lang.Throwable> failures)Adds failures.AuthenticationBuilderaddSuccess(java.lang.String key, AuthenticationHandlerExecutionResult value)Adds an authentication success to the map of handler names to successful authentication handler results.AuthenticationBuilderaddSuccesses(java.util.Map<java.lang.String,AuthenticationHandlerExecutionResult> successes)Adds successes authentication builder.AuthenticationBuilderaddWarning(MessageDescriptor warning)Add warning to authentication builder.AuthenticationBuilderaddWarnings(java.util.List<MessageDescriptor> warning)Add warnings to authentication builder.Authenticationbuild()Creates an immutable authentication instance from builder data.java.util.Map<java.lang.String,java.lang.Throwable>getFailures()Gets the authentication failure map.PrincipalgetPrincipal()Gets the authenticated principal.java.util.Map<java.lang.String,AuthenticationHandlerExecutionResult>getSuccesses()Gets the authentication success map.default booleanhasAttribute(java.lang.String name)Has attribute boolean.booleanhasAttribute(java.lang.String name, java.util.function.Predicate<java.lang.Object> value)Has attribute boolean.AuthenticationBuildermergeAttribute(java.lang.String key, java.lang.Object value)Merge attribute.AuthenticationBuildermergeAttribute(java.lang.String key, java.util.List<java.lang.Object> value)Merge attribute.AuthenticationBuildersetAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> attributes)Sets the authentication metadata attributes.AuthenticationBuildersetAuthenticationDate(java.time.ZonedDateTime d)Sets the authentication date and returns this instance.AuthenticationBuildersetFailures(java.util.Map<java.lang.String,java.lang.Throwable> failures)Sets failures.AuthenticationBuildersetPrincipal(Principal p)Sets the principal returns this instance.AuthenticationBuildersetSuccesses(java.util.Map<java.lang.String,AuthenticationHandlerExecutionResult> successes)Set successes authentication builder.AuthenticationBuildersetWarnings(java.util.List<MessageDescriptor> warning)Set warning to authentication builder.
-
-
-
Method Detail
-
getPrincipal
Principal getPrincipal()
Gets the authenticated principal.- Returns:
- Principal. principal
-
setPrincipal
AuthenticationBuilder setPrincipal(Principal p)
Sets the principal returns this instance.- Parameters:
p- Authenticated principal.- Returns:
- This builder instance.
-
addCredentials
AuthenticationBuilder addCredentials(java.util.List<CredentialMetaData> credentials)
Add credentials authentication builder.- Parameters:
credentials- the credentials- Returns:
- the authentication builder
- Since:
- 4.2.0
-
addCredential
AuthenticationBuilder addCredential(CredentialMetaData credential)
Adds metadata about a credential presented for authentication.- Parameters:
credential- Credential metadata.- Returns:
- This builder instance.
-
addWarnings
AuthenticationBuilder addWarnings(java.util.List<MessageDescriptor> warning)
Add warnings to authentication builder.- Parameters:
warning- the warning- Returns:
- the authentication builder
-
addWarning
AuthenticationBuilder addWarning(MessageDescriptor warning)
Add warning to authentication builder.- Parameters:
warning- the warning- Returns:
- the authentication builder
-
setWarnings
AuthenticationBuilder setWarnings(java.util.List<MessageDescriptor> warning)
Set warning to authentication builder.- Parameters:
warning- the warning- Returns:
- the authentication builder
-
addAttribute
AuthenticationBuilder addAttribute(java.lang.String key, java.util.List<java.lang.Object> value)
Adds an authentication metadata attribute key-value pair.- Parameters:
key- Authentication attribute key.value- Authentication attribute value.- Returns:
- This builder instance.
-
addAttribute
AuthenticationBuilder addAttribute(java.lang.String key, java.lang.Object value)
Adds an authentication metadata attribute key-value pair.- Parameters:
key- Authentication attribute key.value- Authentication attribute value.- Returns:
- This builder instance.
-
getSuccesses
java.util.Map<java.lang.String,AuthenticationHandlerExecutionResult> getSuccesses()
Gets the authentication success map.- Returns:
- Non -null map of handler names to successful handler authentication results.
-
setSuccesses
AuthenticationBuilder setSuccesses(java.util.Map<java.lang.String,AuthenticationHandlerExecutionResult> successes)
Set successes authentication builder.- Parameters:
successes- the successes- Returns:
- the authentication builder
- Since:
- 4.2.0
-
addSuccesses
AuthenticationBuilder addSuccesses(java.util.Map<java.lang.String,AuthenticationHandlerExecutionResult> successes)
Adds successes authentication builder.- Parameters:
successes- the successes- Returns:
- the authentication builder
- Since:
- 4.2.0
-
addFailures
AuthenticationBuilder addFailures(java.util.Map<java.lang.String,java.lang.Throwable> failures)
Adds failures.- Parameters:
failures- the failures- Returns:
- the failures
- Since:
- 4.2.0
-
addSuccess
AuthenticationBuilder addSuccess(java.lang.String key, AuthenticationHandlerExecutionResult value)
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.
-
setAuthenticationDate
AuthenticationBuilder setAuthenticationDate(java.time.ZonedDateTime d)
Sets the authentication date and returns this instance.- Parameters:
d- Authentication date.- Returns:
- This builder instance.
-
build
Authentication build()
Creates an immutable authentication instance from builder data.- Returns:
- Immutable authentication.
-
getFailures
java.util.Map<java.lang.String,java.lang.Throwable> getFailures()
Gets the authentication failure map.- Returns:
- Non -null authentication failure map.
-
setFailures
AuthenticationBuilder setFailures(java.util.Map<java.lang.String,java.lang.Throwable> failures)
Sets failures.- Parameters:
failures- the failures- Returns:
- the failures
-
addFailure
AuthenticationBuilder addFailure(java.lang.String key, java.lang.Throwable value)
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
AuthenticationBuilder setAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> attributes)
Sets the authentication metadata attributes.- Parameters:
attributes- Non-null map of authentication metadata attributes.- Returns:
- This builder instance.
-
mergeAttribute
AuthenticationBuilder mergeAttribute(java.lang.String key, java.lang.Object value)
Merge attribute.- Parameters:
key- the keyvalue- the value- Returns:
- the authentication builder
-
mergeAttribute
AuthenticationBuilder mergeAttribute(java.lang.String key, java.util.List<java.lang.Object> value)
Merge attribute.- Parameters:
key- the keyvalue- the value- Returns:
- the authentication builder
-
hasAttribute
boolean hasAttribute(java.lang.String name, java.util.function.Predicate<java.lang.Object> value)Has attribute boolean.- Parameters:
name- the namevalue- the value- Returns:
- true /false
-
hasAttribute
default boolean hasAttribute(java.lang.String name)
Has attribute boolean.- Parameters:
name- the name- Returns:
- the boolean
-
-