Session-id in RestController

Viewed 424

In my RestController I'm using

RequestContextHolder.getRequestAttributes().getSessionId()

to get the session id. For differet requests (separate endpoints) from the same browser, the session id returned is different.

Is there anything specific that I need to do from UI to have same session ids in the backend for a user's session? (I'm using react-redux for UI)

application.properties:


## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://localhost:3306/some_db?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true
spring.datasource.username = root
spring.datasource.password = something
spring.datasource.initialization-mode=always

spring.session.store-type=JDBC
spring.session.jdbc.initialize-schema=always
spring.session.timeout.seconds=36000

## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect

# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update

server.port = 8089

logging.level.root=DEBUG

server.ssl.enabled=true

# The format used for the keystore. It could be set to JKS in case it is a JKS file
server.ssl.key-store-type=PKCS12
# The path to the keystore containing the certificate
server.ssl.key-store=classpath:keystore/xyz.p12
# The password used to generate the certificate
server.ssl.key-store-password=something
# The alias mapped to the certificate
server.ssl.key-alias=something
0 Answers
Related