public interface CSRFTokenSigner
This trait should not be used as a general purpose encryption utility.
Modifier and Type | Method and Description |
---|---|
play.api.libs.crypto.CSRFTokenSigner |
asScala()
Utility method needed for CSRFCheck.
|
boolean |
compareSignedTokens(java.lang.String tokenA,
java.lang.String tokenB)
Compare two signed tokens.
|
boolean |
constantTimeEquals(java.lang.String a,
java.lang.String b)
Deprecated.
since 2.6.0. Use java.security.MessageDigest.isEqual over this method.
|
java.lang.String |
extractSignedToken(java.lang.String token)
Extract a signed token that was signed by
signToken(String) . |
java.lang.String |
generateSignedToken()
Generates a signed token by calling generateToken / signToken.
|
java.lang.String |
generateToken()
Generates a cryptographically secure token.
|
java.lang.String |
signToken(java.lang.String token)
Sign a token.
|
java.lang.String generateToken()
java.lang.String generateSignedToken()
java.lang.String signToken(java.lang.String token)
This primarily exists to defeat the BREACH vulnerability, as it allows the token to effectively be random per request, without actually changing the value.
token
- The token to signjava.lang.String extractSignedToken(java.lang.String token)
signToken(String)
.token
- The signed token to extract.boolean compareSignedTokens(java.lang.String tokenA, java.lang.String tokenB)
tokenA
- the first tokentokenB
- another token@Deprecated boolean constantTimeEquals(java.lang.String a, java.lang.String b)
Given a length that both Strings are equal to, this method will always run in constant time. This prevents timing attacks.
a
- a string.b
- another string.play.api.libs.crypto.CSRFTokenSigner asScala()