Package org.apereo.cas.authentication
Class DefaultAuthenticationBuilder
java.lang.Object
org.apereo.cas.authentication.DefaultAuthenticationBuilder
- All Implemented Interfaces:
Serializable,org.apereo.cas.authentication.AuthenticationBuilder
public class DefaultAuthenticationBuilder
extends Object
implements org.apereo.cas.authentication.AuthenticationBuilder
Constructs immutable
Authentication objects using the builder pattern.- Since:
- 4.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultAuthenticationBuilder(org.apereo.cas.authentication.principal.Principal principal) -
Method Summary
Modifier and TypeMethodDescriptionorg.apereo.cas.authentication.AuthenticationBuilderaddAttribute(String key, Object value) org.apereo.cas.authentication.AuthenticationBuilderaddAttribute(String key, List<Object> value) org.apereo.cas.authentication.AuthenticationBuilderaddAttributes(Map<String, Object> attributes) org.apereo.cas.authentication.AuthenticationBuilderaddCredential(org.apereo.cas.authentication.Credential credential) org.apereo.cas.authentication.AuthenticationBuilderaddCredentials(List<org.apereo.cas.authentication.Credential> credentials) org.apereo.cas.authentication.AuthenticationBuilderaddFailure(String key, Throwable value) org.apereo.cas.authentication.AuthenticationBuilderaddFailures(@NonNull Map<String, Throwable> failures) org.apereo.cas.authentication.AuthenticationBuilderaddSuccess(String key, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult value) org.apereo.cas.authentication.AuthenticationBuilderaddSuccesses(@NonNull Map<String, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes) org.apereo.cas.authentication.AuthenticationBuilderaddWarning(org.apereo.cas.authentication.MessageDescriptor warning) org.apereo.cas.authentication.AuthenticationBuilderaddWarnings(List<org.apereo.cas.authentication.MessageDescriptor> warning) org.apereo.cas.authentication.Authenticationbuild()Authentication metadata attributes.Authentication date.List<org.apereo.cas.authentication.Credential> Map of handler names to authentication failures.org.apereo.cas.authentication.principal.PrincipalAuthenticated principal.Map of handler names to authentication successes.List<org.apereo.cas.authentication.MessageDescriptor> Warnings here are considered global and apply to the authentication event vs individual attempts and results.booleanhasAttribute(String name, Predicate<Object> predicate) org.apereo.cas.authentication.AuthenticationBuildermergeAttribute(String key, Object value) org.apereo.cas.authentication.AuthenticationBuildermergeAttribute(String key, List<Object> value) static org.apereo.cas.authentication.AuthenticationBuilderCreates a new builder.static org.apereo.cas.authentication.AuthenticationBuildernewInstance(org.apereo.cas.authentication.Authentication source) Creates a new builder initialized with data from the given authentication source.static org.apereo.cas.authentication.AuthenticationBuildernewInstance(org.apereo.cas.authentication.principal.Principal principal) New instance authentication builder with a principal.static org.apereo.cas.authentication.AuthenticationBuilderof(org.springframework.context.ApplicationContext applicationContext, org.apereo.cas.authentication.principal.Principal principal, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, Map<String, List<Object>> principalAttributes, org.apereo.cas.authentication.principal.Service service, org.apereo.cas.services.RegisteredService registeredService, org.apereo.cas.authentication.Authentication authentication) Factory method.org.apereo.cas.authentication.AuthenticationBuildersetAttributes(Map<String, List<Object>> attributes) org.apereo.cas.authentication.AuthenticationBuildersetAuthenticationDate(ZonedDateTime dateTime) org.apereo.cas.authentication.AuthenticationBuildersetCredentials(@NonNull List<org.apereo.cas.authentication.Credential> credentials) Sets the list of metadata about credentials presented for authentication.org.apereo.cas.authentication.AuthenticationBuildersetFailures(@NonNull Map<String, Throwable> failures) org.apereo.cas.authentication.AuthenticationBuildersetPrincipal(org.apereo.cas.authentication.principal.Principal p) org.apereo.cas.authentication.AuthenticationBuildersetSuccesses(@NonNull Map<String, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes) org.apereo.cas.authentication.AuthenticationBuildersetWarnings(List<org.apereo.cas.authentication.MessageDescriptor> warning) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apereo.cas.authentication.AuthenticationBuilder
hasAttribute, mergeAttributes
-
Constructor Details
-
DefaultAuthenticationBuilder
public DefaultAuthenticationBuilder() -
DefaultAuthenticationBuilder
public DefaultAuthenticationBuilder(org.apereo.cas.authentication.principal.Principal principal)
-
-
Method Details
-
newInstance
public static org.apereo.cas.authentication.AuthenticationBuilder newInstance(org.apereo.cas.authentication.Authentication source) Creates a new builder initialized with data from the given authentication source.- Parameters:
source- Authentication source.- Returns:
- New builder instance initialized with all fields in the given authentication source.
-
newInstance
public static org.apereo.cas.authentication.AuthenticationBuilder newInstance()Creates a new builder.- Returns:
- New builder instance
-
newInstance
public static org.apereo.cas.authentication.AuthenticationBuilder newInstance(org.apereo.cas.authentication.principal.Principal principal) New instance authentication builder with a principal.- Parameters:
principal- the principal- Returns:
- the authentication builder
-
of
public static org.apereo.cas.authentication.AuthenticationBuilder of(org.springframework.context.ApplicationContext applicationContext, org.apereo.cas.authentication.principal.Principal principal, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, Map<String, List<Object>> principalAttributes, org.apereo.cas.authentication.principal.Service service, org.apereo.cas.services.RegisteredService registeredService, org.apereo.cas.authentication.Authentication authentication) throws ThrowableFactory method.- Parameters:
applicationContext- the application contextprincipal- principal.principalFactory- principalFactory.principalAttributes- principalAttributes.service- service.registeredService- registeredService.authentication- authentication.- Returns:
- AuthenticationBuilder new AuthenticationBuilder instance.
- Throws:
Throwable- the throwable
-
setPrincipal
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setPrincipal(org.apereo.cas.authentication.principal.Principal p) - Specified by:
setPrincipalin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addCredentials
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addCredentials(List<org.apereo.cas.authentication.Credential> credentials) - Specified by:
addCredentialsin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addCredential
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addCredential(org.apereo.cas.authentication.Credential credential) - Specified by:
addCredentialin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addWarnings
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addWarnings(List<org.apereo.cas.authentication.MessageDescriptor> warning) - Specified by:
addWarningsin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addWarning
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addWarning(org.apereo.cas.authentication.MessageDescriptor warning) - Specified by:
addWarningin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setWarnings
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setWarnings(List<org.apereo.cas.authentication.MessageDescriptor> warning) - Specified by:
setWarningsin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addAttribute
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addAttribute(String key, List<Object> value) - Specified by:
addAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addAttribute
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addAttribute(String key, Object value) - Specified by:
addAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addAttributes
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addAttributes(Map<String, Object> attributes) - Specified by:
addAttributesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setSuccesses
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setSuccesses(@NonNull @NonNull Map<String, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes) - Specified by:
setSuccessesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addSuccesses
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addSuccesses(@NonNull @NonNull Map<String, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes) - Specified by:
addSuccessesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addFailures
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addFailures(@NonNull @NonNull Map<String, Throwable> failures) - Specified by:
addFailuresin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addSuccess
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addSuccess(String key, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult value) - Specified by:
addSuccessin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
build
@CanIgnoreReturnValue public org.apereo.cas.authentication.Authentication build()- Specified by:
buildin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setFailures
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setFailures(@NonNull @NonNull Map<String, Throwable> failures) - Specified by:
setFailuresin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addFailure
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder addFailure(String key, Throwable value) - Specified by:
addFailurein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setAttributes
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setAttributes(Map<String, List<Object>> attributes) - Specified by:
setAttributesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
mergeAttribute
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder mergeAttribute(String key, Object value) - Specified by:
mergeAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
mergeAttribute
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder mergeAttribute(String key, List<Object> value) - Specified by:
mergeAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setAuthenticationDate
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setAuthenticationDate(ZonedDateTime dateTime) - Specified by:
setAuthenticationDatein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
hasAttribute
- Specified by:
hasAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setCredentials
@CanIgnoreReturnValue public org.apereo.cas.authentication.AuthenticationBuilder setCredentials(@NonNull @NonNull List<org.apereo.cas.authentication.Credential> credentials) Sets the list of metadata about credentials presented for authentication.- Parameters:
credentials- Non-null list of credential metadata.- Returns:
- This builder instance.
-
getCredentials
-
getWarnings
Warnings here are considered global and apply to the authentication event vs individual attempts and results. -
getAttributes
Authentication metadata attributes. -
getSuccesses
public Map<String,org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> getSuccesses()Map of handler names to authentication successes.- Specified by:
getSuccessesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
getFailures
Map of handler names to authentication failures.- Specified by:
getFailuresin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
getPrincipal
public org.apereo.cas.authentication.principal.Principal getPrincipal()Authenticated principal.- Specified by:
getPrincipalin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
getAuthenticationDate
Authentication date.- Specified by:
getAuthenticationDatein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-