Class TokenIdFactory
- java.lang.Object
-
- org.forgerock.openam.cts.api.tokens.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.
-
-
Constructor Summary
Constructors Constructor Description TokenIdFactory(KeyConversion encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringfromSAMLPrimaryTokenId(String primaryId)Converts the SAML primary token ID from CTS to a human readable form.StringfromSAMLSecondaryTokenId(String secondaryId)Converts the SAML secondary token ID from CTS to a human readable form.StringgenerateTokenId(String existingId)Checks that the given id is not null, if so will generate an unique id, and then returns the non-null id.StringtoOAuthTokenStoreId(String tokenId)Converts an OAuth2 token ID to the CTS storage key used by the OAuth2 token store.StringtoSAMLPrimaryTokenId(String requestId)StringtoSAMLSecondaryTokenId(String secondaryKey)StringtoSessionTokenId(InternalSession session)Extract a suitable Id from the InternalSession to use as a Token Id.StringtoSessionTokenId(SessionID sessionID)Extract a suitable Id from the SessionId to use as the Token Id.
-
-
-
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:
generateTokenIdin interfaceTokenIdGenerator- Parameters:
existingId- The existing ID of the token.- Returns:
- Non-null Token Id.
-
-