For the remember me function the credentials provided by the caller are exchanged for a (long-lived) token which is send to the user as the value of a cookie, in a similar way to how the HTTP session ID is send. It should be realized that this token effectively becomes the credential to establish the caller's identity within the application and care should be taken to handle and store the token securely. E.g. by using this feature with a secure transport (SSL/HTTPS), storing a strong hash instead of the actual token, and implementing an expiration policy.
The token is vended by a special purpose IdentityStore-like artifact; an implementation of the
RememberMeIdentityStore.
This support is provided via an implementation of an interceptor spec interceptor that conducts the necessary logic.
Example:
@RequestScoped
@RememberMe
public class CustomAuthenticationMechanism implements HttpAuthenticationMechanism {
// ...
}
Jakarta Expression Language expressions in attributes of type String are evaluated for every request requiring
authentication. Both immediate and deferred syntax is supported, but effectively the semantics
are always deferred.
Note
this facility DOES NOT constitute any kind of "session management" system, but instead
represents a special purpose authentication mechanism using a long-lived token, that is vended and validated by the
RememberMeIdentityStore.
| Modifier and Type | Class and Description |
|---|---|
| public static class | RememberMe.
Supports inline instantiation of the RememberMe annotation. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the cookie should be sent only with HTTP requests (and not be made available to client-side scripting code), false otherwise.Flag to indicate that the remember me cookie should not be exposed to client-side scripting code, and should only be sent with HTTP requests. |
| public String | Returns: an expression evaluating to true if the cookie should be sent only with HTTP requests , false otherwise.Jakarta Expression Language expression variant of |
| public int | |
| public String | Returns: an expression evaluating to an integer designating the max age in seconds for the remember me cookie.Jakarta Expression Language expression variant of |
| public String | |
| public boolean | Returns: true if the cookie should be sent using a secure protocol only false for any protocol.Flag to indicate that the remember me cookie should only be sent using a secure protocol (e.g. HTTPS or SSL). |
| public String | Returns: an expression evaluating to an integer designating the max age in seconds for the remember me cookie.Jakarta Expression Language expression variant of |
| public boolean | Returns: Flag to determine if remember me should be usedFlag to determine if remember me should be used. |
| public String | Returns: Jakarta Expression Language expression to determine if remember me should be usedJakarta Expression Language expression to determine if remember me should be used. |
| cookieHttpOnly | back to summary |
|---|---|
| public boolean cookieHttpOnly() Flag to indicate that the remember me cookie should not be exposed to client-side scripting code, and should only be sent with HTTP requests.
| |
| cookieHttpOnlyExpression | back to summary |
|---|---|
| public String cookieHttpOnlyExpression() Jakarta Expression Language expression variant of
| |
| cookieMaxAgeSeconds | back to summary |
|---|---|
| public int cookieMaxAgeSeconds() Max age in seconds for the remember me cookie. Defaults to one day.
| |
| cookieMaxAgeSecondsExpression | back to summary |
|---|---|
| public String cookieMaxAgeSecondsExpression() Jakarta Expression Language expression variant of
| |
| cookieName | back to summary |
|---|---|
| public String cookieName() Name of the remember me cookie.
| |
| cookieSecureOnly | back to summary |
|---|---|
| public boolean cookieSecureOnly() Flag to indicate that the remember me cookie should only be sent using a secure protocol (e.g. HTTPS or SSL).
| |
| cookieSecureOnlyExpression | back to summary |
|---|---|
| public String cookieSecureOnlyExpression() Jakarta Expression Language expression variant of
| |
| isRememberMe | back to summary |
|---|---|
| public boolean isRememberMe() Flag to determine if remember me should be used.
| |
| isRememberMeExpression | back to summary |
|---|---|
| public String isRememberMeExpression() Jakarta Expression Language expression to determine if remember me should be used. This is evaluated for every
request requiring authentication. The expression needs to evaluate to a boolean outcome. All named CDI beans are
available to the expression as well as default classes as specified by Jakarta Expression Language 3.0 for the
| |
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final String | |
| private final int | |
| private final String | |
| private final String | |
| private final boolean | |
| private final String | |
| public static final RememberMe. | INSTANCE
Default instance of the |
| private final boolean | |
| private final String | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | cookieHttpOnly()
Implements jakarta. Flag to indicate that the remember me cookie should not be exposed to client-side scripting code, and should only be sent with HTTP requests. |
| public String | cookieHttpOnlyExpression()
Implements jakarta. Jakarta Expression Language expression variant of |
| public int | cookieMaxAgeSeconds()
Implements jakarta. Max age in seconds for the remember me cookie. |
| public String | cookieMaxAgeSecondsExpression()
Implements jakarta. Jakarta Expression Language expression variant of |
| public String | cookieName()
Implements jakarta. Name of the remember me cookie. |
| public boolean | cookieSecureOnly()
Implements jakarta. Flag to indicate that the remember me cookie should only be sent using a secure protocol (e.g. HTTPS or SSL). |
| public String | cookieSecureOnlyExpression()
Implements jakarta. Jakarta Expression Language expression variant of |
| public boolean | isRememberMe()
Implements jakarta. Flag to determine if remember me should be used. |
| public String | isRememberMeExpression()
Implements jakarta. Jakarta Expression Language expression to determine if remember me should be used. |
| public static RememberMe. | Returns: instance of theRememberMe Interceptor BindingMax age in seconds for the remember me cookie. cookieMaxAgeSeconds, String Jakarta Expression Language expression variant of cookieMaxAgeSecondsExpression, boolean cookieMaxAgeSecondsFlag to indicate that the remember me cookie should only be sent using a secure protocol cookieSecureOnly, String Jakarta Expression Language expression variant of cookieSecureOnlyExpression, boolean cookieSecureOnlytrue if the cookie should be sent only with HTTP requests cookieHttpOnly, String Jakarta Expression Language expression variant of cookieHttpOnlyExpression, String cookieHttpOnlyName of the remember me cookie. cookieName, boolean Flag to determine if remember me should be used. isRememberMe, String Jakarta Expression Language expression variant of isRememberMeExpression)isRememberMeInstance of the |
| cookieHttpOnly | back to summary |
|---|---|
| private final boolean cookieHttpOnly | |
| cookieHttpOnlyExpression | back to summary |
|---|---|
| private final String cookieHttpOnlyExpression | |
| cookieMaxAgeSeconds | back to summary |
|---|---|
| private final int cookieMaxAgeSeconds | |
| cookieMaxAgeSecondsExpression | back to summary |
|---|---|
| private final String cookieMaxAgeSecondsExpression | |
| cookieName | back to summary |
|---|---|
| private final String cookieName | |
| cookieSecureOnly | back to summary |
|---|---|
| private final boolean cookieSecureOnly | |
| cookieSecureOnlyExpression | back to summary |
|---|---|
| private final String cookieSecureOnlyExpression | |
| INSTANCE | back to summary |
|---|---|
| public static final RememberMe. Default instance of the | |
| isRememberMe | back to summary |
|---|---|
| private final boolean isRememberMe | |
| isRememberMeExpression | back to summary |
|---|---|
| private final String isRememberMeExpression | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides jakarta. | |
| Literal | back to summary |
|---|---|
| private Literal(int cookieMaxAgeSeconds, String cookieMaxAgeSecondsExpression, boolean cookieSecureOnly, String cookieSecureOnlyExpression, boolean cookieHttpOnly, String cookieHttpOnlyExpression, String cookieName, boolean isRememberMe, String isRememberMeExpression) | |
| cookieHttpOnly | back to summary |
|---|---|
| public boolean cookieHttpOnly() Implements jakarta. Doc from jakarta. Flag to indicate that the remember me cookie should not be exposed to client-side scripting code, and should only be sent with HTTP requests.
| |
| cookieHttpOnlyExpression | back to summary |
|---|---|
| public String cookieHttpOnlyExpression() Implements jakarta. Doc from jakarta. Jakarta Expression Language expression variant of | |
| cookieMaxAgeSeconds | back to summary |
|---|---|
| public int cookieMaxAgeSeconds() Implements jakarta. Doc from jakarta. Max age in seconds for the remember me cookie. Defaults to one day.
| |
| cookieMaxAgeSecondsExpression | back to summary |
|---|---|
| public String cookieMaxAgeSecondsExpression() Implements jakarta. Doc from jakarta. Jakarta Expression Language expression variant of | |
| cookieName | back to summary |
|---|---|
| public String cookieName() Implements jakarta. Doc from jakarta. Name of the remember me cookie. | |
| cookieSecureOnly | back to summary |
|---|---|
| public boolean cookieSecureOnly() Implements jakarta. Doc from jakarta. Flag to indicate that the remember me cookie should only be sent using a secure protocol (e.g. HTTPS or SSL).
| |
| cookieSecureOnlyExpression | back to summary |
|---|---|
| public String cookieSecureOnlyExpression() Implements jakarta. Doc from jakarta. Jakarta Expression Language expression variant of | |
| isRememberMe | back to summary |
|---|---|
| public boolean isRememberMe() Implements jakarta. Doc from jakarta. Flag to determine if remember me should be used.
| |
| isRememberMeExpression | back to summary |
|---|---|
| public String isRememberMeExpression() Implements jakarta. Doc from jakarta. Jakarta Expression Language expression to determine if remember me should be used. This is evaluated for every
request requiring authentication. The expression needs to evaluate to a boolean outcome. All named CDI beans are
available to the expression as well as default classes as specified by Jakarta Expression Language 3.0 for the
| |
| of | back to summary |
|---|---|
| public static RememberMe. Instance of the
| |