类 HeaderSessionIdResolver
java.lang.Object
cn.taketoday.session.HeaderSessionIdResolver
- 所有已实现的接口:
SessionIdResolver
A
HeaderSessionIdResolver that uses a header to resolve the session id.
Specifically, this implementation will allow specifying a header name using
HeaderSessionIdResolver(String). Convenience factory methods for creating
instances that use common header names, such as "X-Auth-Token" and
"Authentication-Info", are available as well.
When a session is created, the HTTP response will have a response header of the specified name and the value of the session id. For example:
HTTP/1.1 200 OK X-Auth-Token: f81d4fae-7dec-11d0-a765-00a0c91e6bf6The client should now include the session in each request by specifying the same header in their request. For example:
GET /messages/ HTTP/1.1 Host: example.com X-Auth-Token: f81d4fae-7dec-11d0-a765-00a0c91e6bf6When the session is invalidated, the server will send an HTTP response that has the header name and a blank value. For example:
HTTP/1.1 200 OK X-Auth-Token:
- 从以下版本开始:
- 2019-10-03 10:56
- 作者:
- Harry Yang
-
字段概要
字段从接口继承的字段 cn.taketoday.session.SessionIdResolver
WRITTEN_SESSION_ID_ATTR -
构造器概要
构造器构造器说明HeaderSessionIdResolver(String headerName) The name of the header to obtain the session id from. -
方法概要
修饰符和类型方法说明static HeaderSessionIdResolverConvenience factory to createHeaderSessionIdResolverthat uses "Authentication-Info" header.voidexpireSession(RequestContext exchange) Instruct the client to end the current session.getSessionId(RequestContext context) Resolving session id from RequestContextvoidsetSessionId(RequestContext context, String sessionId) Send the given session id to the client.static HeaderSessionIdResolverConvenience factory to createHeaderSessionIdResolverthat uses "X-Auth-Token" header.
-
字段详细资料
-
构造器详细资料
-
HeaderSessionIdResolver
The name of the header to obtain the session id from.- 参数:
headerName- the name of the header to obtain the session id from.
-
-
方法详细资料
-
getSessionId
从接口复制的说明:SessionIdResolverResolving session id from RequestContextsession id including
applied session id- 指定者:
getSessionId在接口中SessionIdResolver- 参数:
context- request context- 返回:
- session id
-
setSessionId
从接口复制的说明:SessionIdResolverSend the given session id to the client.- 指定者:
setSessionId在接口中SessionIdResolver- 参数:
context- the current contextsessionId- the session id
-
expireSession
从接口复制的说明:SessionIdResolverInstruct the client to end the current session.- 指定者:
expireSession在接口中SessionIdResolver- 参数:
exchange- the current exchange
-
xAuthToken
Convenience factory to createHeaderSessionIdResolverthat uses "X-Auth-Token" header.- 返回:
- the instance configured to use "X-Auth-Token" header
-
authenticationInfo
Convenience factory to createHeaderSessionIdResolverthat uses "Authentication-Info" header.- 返回:
- the instance configured to use "Authentication-Info" header
-