Package org.apache.myfaces.util.token
Class CsrfSessionTokenFactorySecureRandom
- java.lang.Object
-
- org.apache.myfaces.util.token.CsrfSessionTokenFactory
-
- org.apache.myfaces.util.token.CsrfSessionTokenFactorySecureRandom
-
public class CsrfSessionTokenFactorySecureRandom extends CsrfSessionTokenFactory
This factory generate a key composed by a counter and a random number. The counter ensures uniqueness, and the random number prevents guess the next session token.- Since:
- 2.2
- Author:
- Leonardo Uribe
-
-
Field Summary
Fields Modifier and Type Field Description static String
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_ALGORITM_PARAM
Sets the random algorithm to initialize the secure random id generator.static String
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_CLASS_PARAM
Sets the random class to initialize the secure random id generator.static String
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_PROVIDER_PARAM
Sets the random provider to initialize the secure random id generator.-
Fields inherited from class org.apache.myfaces.util.token.CsrfSessionTokenFactory
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_LENGTH_PARAM, RANDOM_KEY_IN_CSRF_SESSION_TOKEN_LENGTH_PARAM_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description CsrfSessionTokenFactorySecureRandom(FacesContext facesContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createToken(FacesContext context)
protected byte[]
generateKey(FacesContext facesContext)
-
-
-
Field Detail
-
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_CLASS_PARAM
@JSFWebConfigParam(since="2.2.0", group="state") public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_CLASS_PARAM
Sets the random class to initialize the secure random id generator. By default it uses java.security.SecureRandom- See Also:
- Constant Field Values
-
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_PROVIDER_PARAM
@JSFWebConfigParam(since="2.2.0", group="state") public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_PROVIDER_PARAM
Sets the random provider to initialize the secure random id generator.- See Also:
- Constant Field Values
-
RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_ALGORITM_PARAM
@JSFWebConfigParam(since="2.2.0", defaultValue="SHA1PRNG", group="state") public static final String RANDOM_KEY_IN_CSRF_SESSION_TOKEN_SECURE_RANDOM_ALGORITM_PARAM
Sets the random algorithm to initialize the secure random id generator. By default is SHA1PRNG- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CsrfSessionTokenFactorySecureRandom
public CsrfSessionTokenFactorySecureRandom(FacesContext facesContext)
-
-
Method Detail
-
generateKey
protected byte[] generateKey(FacesContext facesContext)
-
createToken
public String createToken(FacesContext context)
- Specified by:
createToken
in classCsrfSessionTokenFactory
-
-