Class TokenIdFactory

  • All Implemented Interfaces:
    TokenIdGenerator

    public class TokenIdFactory
    extends Object
    implements TokenIdGenerator
    Responsible for generating Token Ids and for converting objects into their corresponding Token Ids.
    • Field Detail

      • ID

        public static final String ID
    • Constructor Detail

      • TokenIdFactory

        @Inject
        public TokenIdFactory​(KeyConversion encoding)
    • Method Detail

      • toSAMLPrimaryTokenId

        public String toSAMLPrimaryTokenId​(String requestId)
        Parameters:
        requestId - The request Id to convert to a Token Id.
        Returns:
        Non null Token Id.
      • fromSAMLPrimaryTokenId

        public String fromSAMLPrimaryTokenId​(String primaryId)
        Converts the SAML primary token ID from CTS to a human readable form.
        Parameters:
        primaryId - The primary token ID for the SAML token. May not be null.
        Returns:
        Non null ID.
      • toSAMLSecondaryTokenId

        public String toSAMLSecondaryTokenId​(String secondaryKey)
        Parameters:
        secondaryKey - The secondary key to convert to a Token Id.
        Returns:
        Non null Token Id.
      • fromSAMLSecondaryTokenId

        public String fromSAMLSecondaryTokenId​(String secondaryId)
        Converts the SAML secondary token ID from CTS to a human readable form.
        Parameters:
        secondaryId - The secondary token ID for the SAML token. May not be null.
        Returns:
        Non null ID.
      • toOAuthTokenStoreId

        public String toOAuthTokenStoreId​(String tokenId)
        Converts an OAuth2 token ID to the CTS storage key used by the OAuth2 token store.
        Parameters:
        tokenId - The OAuth2 token ID to convert. May not be null.
        Returns:
        Non null token storage key.
      • toSessionTokenId

        public String toSessionTokenId​(InternalSession session)
        Extract a suitable Id from the InternalSession to use as a Token Id.
        Parameters:
        session - InternalSession to use.
        Returns:
        Non null Token Id.
      • toSessionTokenId

        public String toSessionTokenId​(SessionID sessionID)
        Extract a suitable Id from the SessionId to use as the Token Id.
        Parameters:
        sessionID - SessionID to use.
        Returns:
        Non null Token Id.
      • generateTokenId

        public String generateTokenId​(String existingId)
        Checks that the given id is not null, if so will generate an unique id, and then returns the non-null id.
        Specified by:
        generateTokenId in interface TokenIdGenerator
        Parameters:
        existingId - The existing ID of the token.
        Returns:
        Non-null Token Id.