Reputation: 172
My web-application is spring based. I have this job scheduled every one hour , and what the job should do is to create a sessionId and send it to another application. The purpose is to enable the other application to login to my system.
As far I understand, request.getSession() can be used if and only if there is a user request coming from the client. Since My job is a scheduled one, the user might not be logged into the system at all.
How should I approach my problem?
Upvotes: 0
Views: 5005
Reputation: 159260
You should approach the problem by not using session ID for anything.
The session ID assigned as a query parameter or cookie value is for associating a HttpSession
object maintained on the server with a particular browser instance. It's internal and has no meaning to you. It may even change often, if you configure for very high security.
The session ID value has no meaning. It is just a token for identifying a previously created session. Sending an unknown token to an application is the same as not sending a token, i.e. the application creates a new session and returns a new session ID token for that session as part of the response.
Upvotes: 1