Class SessionConfiguration
java.lang.Object
com.irurueta.authserver.bff.infrastructure.session.SessionConfiguration
Names the cookie of the HTTP session of the BFF with the
__Host- prefix. The session itself is stored in
PostgreSQL by Spring Session JDBC (table spring_session, owned by the Flyway migration V300 of this
module), which Spring Boot auto-configures from spring-boot-starter-session-jdbc.
There is deliberately no @EnableJdbcHttpSession: that annotation switches Spring Boot's session
auto-configuration off, and with it every spring.session.* property (for example
spring.session.jdbc.initialize-schema: never, which keeps the schema in Flyway's hands, or
spring.session.timeout). The session holds the OAuth2 tokens of the user (the authorized client), which
therefore never reach the browser; the cookie is only a handle to them.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringName of the session cookie; the__Host-prefix makes browsers require Secure, Path=/ and no Domain. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) org.springframework.session.web.http.CookieSerializerBuilds the serializer of the session cookie: Secure, HttpOnly, SameSite=Lax, path/and no domain, which is exactly what the__Host-prefix demands (the browser rejects the cookie otherwise).
-
Field Details
-
COOKIE_NAME
Name of the session cookie; the__Host-prefix makes browsers require Secure, Path=/ and no Domain.- See Also:
-
-
Constructor Details
-
SessionConfiguration
public SessionConfiguration()
-
-
Method Details
-
cookieSerializer
@Bean org.springframework.session.web.http.CookieSerializer cookieSerializer()Builds the serializer of the session cookie: Secure, HttpOnly, SameSite=Lax, path/and no domain, which is exactly what the__Host-prefix demands (the browser rejects the cookie otherwise).- Returns:
- the cookie serializer.
-