I'm working on a Spring Boot project that uses Oauth. I recently used Spring session in my project to configure concurrent session control using JDBC. Here is my requirement - I need to keep history on the spring_session table for at least 6 months for reporting purposes. We need to know how many users are using the application and who those users are.
I thought I could use the spring_session table to meet my requirement, but based on my testing, it appears that I cannot use this table for the foll. reasons
a. The PRINCIPAL_NAME column in the table does not give me the username(or gmail id for Gmail Oauth). It gets populated with a random stream of characters that appears to be some unique id generated by Spring.
b. When a user logs out, the record for the user gets deleted from the spring_session table.
I can track the logged in and logged out users myself in a success handler after oauth authentication and in the logout handler. But I wanted to check if there is a way to accomplish this with spring session before I went ahead and implemented my own solution. I looked thru the documentation but didn't find a way to do this with the current set of tables populated by spring session.