Package org.apereo.cas.authentication
Class DefaultAuthenticationBuilder
- java.lang.Object
-
- org.apereo.cas.authentication.DefaultAuthenticationBuilder
-
- All Implemented Interfaces:
java.io.Serializable,org.apereo.cas.authentication.AuthenticationBuilder
public class DefaultAuthenticationBuilder extends java.lang.Object implements org.apereo.cas.authentication.AuthenticationBuilderConstructs immutableAuthenticationobjects using the builder pattern.- Since:
- 4.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthenticationBuilder()Creates a new instance using the current date for the authentication date.DefaultAuthenticationBuilder(org.apereo.cas.authentication.principal.Principal p)Creates a new instance using the current date for the authentication date and the given principal for the authenticated principal.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apereo.cas.authentication.AuthenticationBuilderaddAttribute(java.lang.String key, java.lang.Object value)org.apereo.cas.authentication.AuthenticationBuilderaddAttribute(java.lang.String key, java.util.List<java.lang.Object> value)org.apereo.cas.authentication.AuthenticationBuilderaddAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)org.apereo.cas.authentication.AuthenticationBuilderaddCredential(org.apereo.cas.authentication.CredentialMetaData credential)org.apereo.cas.authentication.AuthenticationBuilderaddCredentials(java.util.List<org.apereo.cas.authentication.CredentialMetaData> credentials)org.apereo.cas.authentication.AuthenticationBuilderaddFailure(java.lang.String key, java.lang.Throwable value)org.apereo.cas.authentication.AuthenticationBuilderaddFailures(@NonNull java.util.Map<java.lang.String,java.lang.Throwable> failures)org.apereo.cas.authentication.AuthenticationBuilderaddSuccess(java.lang.String key, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult value)org.apereo.cas.authentication.AuthenticationBuilderaddSuccesses(@NonNull java.util.Map<java.lang.String,org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes)org.apereo.cas.authentication.AuthenticationBuilderaddWarning(org.apereo.cas.authentication.MessageDescriptor warning)org.apereo.cas.authentication.AuthenticationBuilderaddWarnings(java.util.List<org.apereo.cas.authentication.MessageDescriptor> warning)org.apereo.cas.authentication.Authenticationbuild()booleanhasAttribute(java.lang.String name, java.util.function.Predicate<java.lang.Object> predicate)org.apereo.cas.authentication.AuthenticationBuildermergeAttribute(java.lang.String key, java.lang.Object value)org.apereo.cas.authentication.AuthenticationBuildermergeAttribute(java.lang.String key, java.util.List<java.lang.Object> value)static org.apereo.cas.authentication.AuthenticationBuildernewInstance()Creates 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.AuthenticationBuilderof(org.apereo.cas.authentication.principal.Principal principal, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.util.Map<java.lang.String,java.util.List<java.lang.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(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> attributes)org.apereo.cas.authentication.AuthenticationBuildersetAuthenticationDate(java.time.ZonedDateTime d)org.apereo.cas.authentication.AuthenticationBuildersetCredentials(@NonNull java.util.List<org.apereo.cas.authentication.CredentialMetaData> credentials)Sets the list of metadata about credentials presented for authentication.org.apereo.cas.authentication.AuthenticationBuildersetFailures(@NonNull java.util.Map<java.lang.String,java.lang.Throwable> failures)org.apereo.cas.authentication.AuthenticationBuildersetPrincipal(org.apereo.cas.authentication.principal.Principal p)org.apereo.cas.authentication.AuthenticationBuildersetSuccesses(@NonNull java.util.Map<java.lang.String,org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes)org.apereo.cas.authentication.AuthenticationBuildersetWarnings(java.util.List<org.apereo.cas.authentication.MessageDescriptor> warning)
-
-
-
Constructor Detail
-
DefaultAuthenticationBuilder
public DefaultAuthenticationBuilder()
Creates a new instance using the current date for the authentication date.
-
DefaultAuthenticationBuilder
public DefaultAuthenticationBuilder(org.apereo.cas.authentication.principal.Principal p)
Creates a new instance using the current date for the authentication date and the given principal for the authenticated principal.- Parameters:
p- Authenticated principal.
-
-
Method Detail
-
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
-
of
public static org.apereo.cas.authentication.AuthenticationBuilder of(org.apereo.cas.authentication.principal.Principal principal, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.util.Map<java.lang.String,java.util.List<java.lang.Object>> principalAttributes, org.apereo.cas.authentication.principal.Service service, org.apereo.cas.services.RegisteredService registeredService, org.apereo.cas.authentication.Authentication authentication)Factory method.- Parameters:
principal- principal.principalFactory- principalFactory.principalAttributes- principalAttributes.service- service.registeredService- registeredService.authentication- authentication.- Returns:
- AuthenticationBuilder new AuthenticationBuilder instance.
-
setPrincipal
public org.apereo.cas.authentication.AuthenticationBuilder setPrincipal(org.apereo.cas.authentication.principal.Principal p)
- Specified by:
setPrincipalin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addCredentials
public org.apereo.cas.authentication.AuthenticationBuilder addCredentials(java.util.List<org.apereo.cas.authentication.CredentialMetaData> credentials)
- Specified by:
addCredentialsin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addCredential
public org.apereo.cas.authentication.AuthenticationBuilder addCredential(org.apereo.cas.authentication.CredentialMetaData credential)
- Specified by:
addCredentialin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addWarnings
public org.apereo.cas.authentication.AuthenticationBuilder addWarnings(java.util.List<org.apereo.cas.authentication.MessageDescriptor> warning)
- Specified by:
addWarningsin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addWarning
public org.apereo.cas.authentication.AuthenticationBuilder addWarning(org.apereo.cas.authentication.MessageDescriptor warning)
- Specified by:
addWarningin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setWarnings
public org.apereo.cas.authentication.AuthenticationBuilder setWarnings(java.util.List<org.apereo.cas.authentication.MessageDescriptor> warning)
- Specified by:
setWarningsin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addAttribute
public org.apereo.cas.authentication.AuthenticationBuilder addAttribute(java.lang.String key, java.util.List<java.lang.Object> value)- Specified by:
addAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addAttribute
public org.apereo.cas.authentication.AuthenticationBuilder addAttribute(java.lang.String key, java.lang.Object value)- Specified by:
addAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setSuccesses
public org.apereo.cas.authentication.AuthenticationBuilder setSuccesses(@NonNull @NonNull java.util.Map<java.lang.String,org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes)- Specified by:
setSuccessesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addAttributes
public org.apereo.cas.authentication.AuthenticationBuilder addAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
- Specified by:
addAttributesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addSuccesses
public org.apereo.cas.authentication.AuthenticationBuilder addSuccesses(@NonNull @NonNull java.util.Map<java.lang.String,org.apereo.cas.authentication.AuthenticationHandlerExecutionResult> successes)- Specified by:
addSuccessesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addFailures
public org.apereo.cas.authentication.AuthenticationBuilder addFailures(@NonNull @NonNull java.util.Map<java.lang.String,java.lang.Throwable> failures)- Specified by:
addFailuresin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addSuccess
public org.apereo.cas.authentication.AuthenticationBuilder addSuccess(java.lang.String key, org.apereo.cas.authentication.AuthenticationHandlerExecutionResult value)- Specified by:
addSuccessin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setAuthenticationDate
public org.apereo.cas.authentication.AuthenticationBuilder setAuthenticationDate(java.time.ZonedDateTime d)
- Specified by:
setAuthenticationDatein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
build
public org.apereo.cas.authentication.Authentication build()
- Specified by:
buildin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setFailures
public org.apereo.cas.authentication.AuthenticationBuilder setFailures(@NonNull @NonNull java.util.Map<java.lang.String,java.lang.Throwable> failures)- Specified by:
setFailuresin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
addFailure
public org.apereo.cas.authentication.AuthenticationBuilder addFailure(java.lang.String key, java.lang.Throwable value)- Specified by:
addFailurein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setAttributes
public org.apereo.cas.authentication.AuthenticationBuilder setAttributes(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> attributes)
- Specified by:
setAttributesin interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
mergeAttribute
public org.apereo.cas.authentication.AuthenticationBuilder mergeAttribute(java.lang.String key, java.lang.Object value)- Specified by:
mergeAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
mergeAttribute
public org.apereo.cas.authentication.AuthenticationBuilder mergeAttribute(java.lang.String key, java.util.List<java.lang.Object> value)- Specified by:
mergeAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
hasAttribute
public boolean hasAttribute(java.lang.String name, java.util.function.Predicate<java.lang.Object> predicate)- Specified by:
hasAttributein interfaceorg.apereo.cas.authentication.AuthenticationBuilder
-
setCredentials
public org.apereo.cas.authentication.AuthenticationBuilder setCredentials(@NonNull @NonNull java.util.List<org.apereo.cas.authentication.CredentialMetaData> credentials)Sets the list of metadata about credentials presented for authentication.- Parameters:
credentials- Non-null list of credential metadata.- Returns:
- This builder instance.
-
-