Class CookieSessionInjector<A,B extends Session<A>,C extends ExchangeContext,D extends Exchange<C>>
- Type Parameters:
A
- the session data typeB
- the session typeC
- the exchange context typeD
- the exchange type
- All Implemented Interfaces:
SessionInjector<A,
B, C, D>
A session injector that sets the session identifier in a response cookie.
The secure flag is set on the session cookie when the server is configured with TLS (HTTPS). An application deployed behind an SSL offloader is likely to be configured without TLS and as a result it is up to the SSL offloader to set the secure flag on the session cookie.
- Since:
- 1.13
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default token cookie path:/
.static final Headers.SetCookie.SameSitePolicy
The default cookie same site policy. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a cookie session injector with default path and session cookie name.CookieSessionInjector
(String path) Creates a cookie session injector with specified path and default session cookie name.CookieSessionInjector
(String path, String sessionCookie) Creates a cookie session injector with specified path and session cookie name. -
Method Summary
Modifier and TypeMethodDescriptiongetPath()
Returns the session cookie path.Returns the cookie same site policy.Returns the session cookie name.Injects the specified session into the exchange.Removes the session from the exchange.void
setSameSitePolicy
(Headers.SetCookie.SameSitePolicy sameSitePolicy) Sets the cookie same site policyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.inverno.mod.session.http.SessionInjector
andThen, compose
-
Field Details
-
DEFAULT_PATH
The default token cookie path:/
.- See Also:
-
DEFAULT_SAME_SITE_POLICY
The default cookie same site policy.
-
-
Constructor Details
-
CookieSessionInjector
public CookieSessionInjector()Creates a cookie session injector with default path and session cookie name.
-
CookieSessionInjector
Creates a cookie session injector with specified path and default session cookie name.
- Parameters:
path
- the session cookie path
-
CookieSessionInjector
Creates a cookie session injector with specified path and session cookie name.
- Parameters:
path
- the session cookie pathsessionCookie
- the session cookie name
-
-
Method Details
-
getPath
Returns the session cookie path.
- Returns:
- the session cookie path
-
getSessionCookie
Returns the session cookie name.
- Returns:
- the session cookie name
-
getSameSitePolicy
Returns the cookie same site policy.
- Returns:
- the same site policy
-
setSameSitePolicy
Sets the cookie same site policy
- Parameters:
sameSitePolicy
- a same site policy
-
inject
Description copied from interface:SessionInjector
Injects the specified session into the exchange.
-
remove
Description copied from interface:SessionInjector
Removes the session from the exchange.
-