Class TokenFactoryImpl

java.lang.Object
com.atlassian.crowd.manager.token.factory.TokenFactoryImpl
All Implemented Interfaces:
TokenFactory

public class TokenFactoryImpl extends Object implements TokenFactory
The TokenGenerator is responsible for generating tokens when a successful authentication has occurred.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    TokenFactoryImpl(TokenKeyGenerator tokenKeyGenerator, com.atlassian.security.random.SecureRandomService secureRandomService)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.atlassian.crowd.model.token.Token
    create(long directoryID, String name, com.atlassian.crowd.model.token.TokenLifetime tokenLifetime, List<com.atlassian.crowd.model.authentication.ValidationFactor> validationFactors)
    Generates a token key based on the supplied validationFactors.
    com.atlassian.crowd.model.token.Token
    create(long directoryID, String name, com.atlassian.crowd.model.token.TokenLifetime tokenLifetime, List<com.atlassian.crowd.model.authentication.ValidationFactor> validationFactors, long secretNumber)
    Generates a token key based on the supplied validationFactors.
    protected long
     
    createValidationHash(long directoryID, String name, List<com.atlassian.crowd.model.authentication.ValidationFactor> validationFactors, long secretNumber)
    Generates random hash based on the supplied parameters.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TokenFactoryImpl

      public TokenFactoryImpl(TokenKeyGenerator tokenKeyGenerator, com.atlassian.security.random.SecureRandomService secureRandomService)
    • TokenFactoryImpl

      public TokenFactoryImpl(TokenKeyGenerator tokenKeyGenerator)
  • Method Details

    • create

      public com.atlassian.crowd.model.token.Token create(long directoryID, String name, com.atlassian.crowd.model.token.TokenLifetime tokenLifetime, List<com.atlassian.crowd.model.authentication.ValidationFactor> validationFactors) throws com.atlassian.crowd.exception.InvalidTokenException
      Description copied from interface: TokenFactory
      Generates a token key based on the supplied validationFactors.
      Specified by:
      create in interface TokenFactory
      Parameters:
      directoryID - associated directory for the Token
      name - the name for the token, this may be the 'username' of an associated Principal or application name.
      tokenLifetime - Requested lifetime of the token
      validationFactors - The validation factors that are used when generating a key.
      Returns:
      The generated key.
      Throws:
      com.atlassian.crowd.exception.InvalidTokenException - If there was an error generating the key, usually if there was an encoding exception.
    • create

      public com.atlassian.crowd.model.token.Token create(long directoryID, String name, com.atlassian.crowd.model.token.TokenLifetime tokenLifetime, List<com.atlassian.crowd.model.authentication.ValidationFactor> validationFactors, long secretNumber) throws com.atlassian.crowd.exception.InvalidTokenException
      Description copied from interface: TokenFactory
      Generates a token key based on the supplied validationFactors.
      Specified by:
      create in interface TokenFactory
      Parameters:
      directoryID - associated directory for the Token
      name - the name for the token, this may be the 'username' of an associated Principal or application name.
      tokenLifetime - Requested lifetime of the token
      validationFactors - The validation factors that are used when generating a key.
      secretNumber - The 'secret number' to add as a validation factor
      Returns:
      The generated key.
      Throws:
      com.atlassian.crowd.exception.InvalidTokenException - If there was an error generating the key, usually if there was an encoding exception.
    • createValidationHash

      public String createValidationHash(long directoryID, String name, List<com.atlassian.crowd.model.authentication.ValidationFactor> validationFactors, long secretNumber) throws com.atlassian.crowd.exception.InvalidTokenException
      Description copied from interface: TokenFactory
      Generates random hash based on the supplied parameters.
      Specified by:
      createValidationHash in interface TokenFactory
      Parameters:
      directoryID - associated directory for the Token
      name - the name for the token, this may be the 'username' of an associated Principal or application name.
      validationFactors - The validation factors that are used when generating a key.
      secretNumber - The 'secret number' to add as a validation factor
      Returns:
      Throws:
      com.atlassian.crowd.exception.InvalidTokenException
    • createSecretValidationNumber

      protected long createSecretValidationNumber()