Class CompositeTokenProvider

  • All Implemented Interfaces:
    TokenProvider

    public final class CompositeTokenProvider
    extends java.lang.Object
    implements TokenProvider
    Aggregates a collection of TokenProviders into a single provider.
    • Method Detail

      • newInstance

        @NotNull
        public static @NotNull TokenProvider newInstance​(@NotNull
                                                         @NotNull java.util.List<? extends TokenProvider> providers)
      • doCreateToken

        public boolean doCreateToken​(@NotNull
                                     @NotNull Credentials credentials)
        Description copied from interface: TokenProvider
        Returns true if the given credentials indicate that a new token needs to be issued.
        Specified by:
        doCreateToken in interface TokenProvider
        Parameters:
        credentials - The current credentials.
        Returns:
        true if a new login token needs to be created, false otherwise.
      • createToken

        @Nullable
        public @Nullable TokenInfo createToken​(@NotNull
                                               @NotNull Credentials credentials)
        Description copied from interface: TokenProvider
        Issues a new login token for the user with the specified credentials and returns the associated TokenInfo.
        Specified by:
        createToken in interface TokenProvider
        Parameters:
        credentials - The current credentials.
        Returns:
        The TokenInfo associated with the new login token or null if no token has been created.
      • createToken

        @Nullable
        public @Nullable TokenInfo createToken​(@NotNull
                                               @NotNull java.lang.String userId,
                                               @NotNull
                                               @NotNull java.util.Map<java.lang.String,​?> attributes)
        Description copied from interface: TokenProvider
        Issues a new login token for the user with the given userId and the specified attributes.
        Specified by:
        createToken in interface TokenProvider
        Parameters:
        userId - The identifier of the user for which a new token should be created.
        attributes - The attributes associated with the new token.
        Returns:
        The TokenInfo associated with the new login token or null if no token has been created.
      • getTokenInfo

        @Nullable
        public @Nullable TokenInfo getTokenInfo​(@NotNull
                                                @NotNull java.lang.String token)
        Description copied from interface: TokenProvider
        Retrieves the TokenInfo associated with the specified login token or null.
        Specified by:
        getTokenInfo in interface TokenProvider
        Parameters:
        token - A valid login token.
        Returns:
        the TokenInfo associated with the specified login token or null.