Top Description Inners Fields Methods
javax.mvc.security

public Interface Csrf


Cross Site Request Forgery (CSRF) interface with access to the CSRF header name and the CSRF token value. Implementations of this interface are injectable and accessible from EL via the javax.mvc.MvcContext class as mvc.csrf.
Authors
Santiago Pericas-Geertsen, Christian Kaltepoth
Since
1.0
See Also
CsrfProtected

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
public static final String
CSRF_HEADER_NAME

Property that can be used to configure the name of the HTTP header used for the CSRF token.

public static final String
CSRF_PROTECTION

Property that can be used to globally enable CSRF protection for an application.

public static final String

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

name of CSRF header.
getName
()

Returns the name of the CSRF form field or HTTP request header.

public String

Returns:

value of CSRF token.
getToken
()

Returns the value of the CSRF token.

Field Detail

CSRF_HEADER_NAMEback to summary
public static final String CSRF_HEADER_NAME

Property that can be used to configure the name of the HTTP header used for the CSRF token.

CSRF_PROTECTIONback to summary
public static final String CSRF_PROTECTION

Property that can be used to globally enable CSRF protection for an application. Values of this property must be of type Csrf.CsrfOptions.

DEFAULT_CSRF_HEADER_NAMEback to summary
public static final String DEFAULT_CSRF_HEADER_NAME

The default value for CSRF_HEADER_NAME.

Method Detail

getNameback to summary
public String getName()

Returns the name of the CSRF form field or HTTP request header. This name is typically a constant.

Returns:String

name of CSRF header.

getTokenback to summary
public String getToken()

Returns the value of the CSRF token.

Returns:String

value of CSRF token.

javax.mvc.security back to summary

public final Enum Csrf.CsrfOptions

extends Enum<Csrf.CsrfOptions>
Class Inheritance

Options for property Csrf#CSRF_PROTECTION.

Field Summary

Modifier and TypeField and Description
public static final Csrf.CsrfOptions
EXPLICIT

Enabling CSRF requires use of CsrfProtected explicitly (default).

public static final Csrf.CsrfOptions
IMPLICIT

CSRF enabled automatically for all controllers.

public static final Csrf.CsrfOptions
OFF

CSRF protection not enabled.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Csrf.CsrfOptions
public static Csrf.CsrfOptions[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EXPLICITback to summary
public static final Csrf.CsrfOptions EXPLICIT

Enabling CSRF requires use of CsrfProtected explicitly (default).

IMPLICITback to summary
public static final Csrf.CsrfOptions IMPLICIT

CSRF enabled automatically for all controllers.

OFFback to summary
public static final Csrf.CsrfOptions OFF

CSRF protection not enabled.

Constructor Detail

CsrfOptionsback to summary
private CsrfOptions()

Method Detail

valueOfback to summary
public static Csrf.CsrfOptions valueOf(String name)
valuesback to summary
public static Csrf.CsrfOptions[] values()