Class SynchronizerTokenGenerator

  • All Implemented Interfaces:
    TokenGenerator

    public class SynchronizerTokenGenerator
    extends Object
    implements TokenGenerator
    A generator of synchronizer tokens. The generation of the token is based upon a random key and the generation can be altered by passing it some input parameters.
    • Constructor Detail

      • SynchronizerTokenGenerator

        public SynchronizerTokenGenerator()
    • Method Detail

      • generate

        public SynchronizerToken generate​(TokenGenerationParameter... parameters)
        Generates a new token by taking into account any of the specified generation parameters. The parameters are used to alter the generation of the token. If no parameters are passed, then the token is only generated from a random value.
        Specified by:
        generate in interface TokenGenerator
        Parameters:
        parameters - the parameter for adding entropy in the token generation. Only String-value parameters are taken into account.
        Returns:
        a new token. The length of the token is at least of 48 characters. It can be more longer by passing parameters with a value of more than 48 characters.
      • renew

        public <T extends Token> T renew​(T token)
        Renews the specified token. The token value will be regenerated.
        Specified by:
        renew in interface TokenGenerator
        Type Parameters:
        T - the concrete type of the token to renew.
        Parameters:
        token - the token to renew.
        Returns:
        the renewed token.