Interface AuthenticationBuilder

  • All Superinterfaces:
    java.io.Serializable

    public interface AuthenticationBuilder
    extends java.io.Serializable
    Constructs immutable Authentication objects using the builder pattern.
    Since:
    4.1.0
    • 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
      • 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.
      • 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 key
        value - 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 key
        value - 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 name
        value - the value
        Returns:
        true /false
      • hasAttribute

        default boolean hasAttribute​(java.lang.String name)
        Has attribute boolean.
        Parameters:
        name - the name
        Returns:
        the boolean