Class AuthenticationTokenContext<T>

  • Type Parameters:
    T - the type of token

    @ThreadSafe
    public final class AuthenticationTokenContext<T>
    extends Object
    The context within which an authentication token will be used.
    Since:
    1.2
    • Constructor Detail

      • AuthenticationTokenContext

        public AuthenticationTokenContext​(@NonNull
                                          Class<T> tokenClass)
        Creates a basic context for any purpose.
        Parameters:
        tokenClass - the type of token.
    • Method Detail

      • getTokenClass

        @NonNull
        public Class<T> getTokenClass()
        Returns the type of token.
        Returns:
        the type of token.
      • canHave

        public boolean canHave​(@NonNull
                               Object purpose,
                               Object... validValues)
        Checks if the context specifies the supplied purpose and matches against the valid values.
        Parameters:
        purpose - the purpose.
        validValues - the valid values that the purpose must match if specified.
        Returns:
        true if either the purpose is not specified or the purpose is specified and is equal to one of the specified values.
      • mustHave

        public boolean mustHave​(@NonNull
                                Object purpose,
                                Object... validValues)
        Ensures the context specifies the supplied purpose matching against the valid values.
        Parameters:
        purpose - the purpose.
        validValues - the valid values that the purpose must match.
        Returns:
        true if and only if the purpose is specified and is equal to one of the specified values.