Package io.micronaut.session.http
Class CookieHttpSessionIdGenerator
java.lang.Object
io.micronaut.session.http.CookieHttpSessionIdGenerator
@Singleton
@Requires(property="micronaut.session.http.cookie",
notEquals="false")
public class CookieHttpSessionIdGenerator
extends Object
Utility to generate a session id from a cookie value or builds a cookie value from session.
- Since:
- 1.0.1
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorDescriptionCookieHttpSessionIdGenerator
(HttpSessionConfiguration configuration) Constructor. -
Method Summary
Modifier and TypeMethodDescription@NonNull String
cookieValueFromSession
(@NonNull Session session) boolean
@NonNull String
sessionIdFromCookie
(@NonNull io.micronaut.http.cookie.Cookie cookie)
-
Constructor Details
-
CookieHttpSessionIdGenerator
Constructor.- Parameters:
configuration
- The HTTP session configuration
-
-
Method Details
-
isBase64Decode
public boolean isBase64Decode()- Returns:
- Whether the Base64 encode sessions IDs sent back to clients
-
getPrefix
- Returns:
- The prefix to use when serializing session ID
-
sessionIdFromCookie
@NonNull public @NonNull String sessionIdFromCookie(@NonNull @NonNull io.micronaut.http.cookie.Cookie cookie) - Parameters:
cookie
- A Cookie- Returns:
- A session id from a cookie value
-
cookieValueFromSession
- Parameters:
session
- The session- Returns:
- Cookie value from session.
-