Interface SecureTokenGenerator

All Known Implementing Classes:
DefaultSecureTokenGenerator

public interface SecureTokenGenerator
Generator for randomly generated Strings which can be used for cryptographically secure tokens.

These tokens might be used for cross-site request forgery (XSRF) prevention, authentication representation (eg. forgot password tokens, remember-me tokens).

Implementations are required to be thread-safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    Generates an randomly generated nonce that is suitable for use as an authentication token.
    Generates an randomly generated token that is suitable for use as an authentication token.
  • Method Details

    • generateToken

      String generateToken()
      Generates an randomly generated token that is suitable for use as an authentication token. The token should be treated as an opaque String and not be parsed or interpreted by the client. The returned String will not be longer than 255 characters.
      Returns:
      a randomly generated opaque String.
      See Also:
    • generateNonce

      String generateNonce()
      Generates an randomly generated nonce that is suitable for use as an authentication token. The token should be treated as an opaque String and not be parsed or interpreted by the client.