Reputation: 937
Im developing a java web application which is deployed on a glassfish server. The web services are used to connect to user databases. Each user has a database. My question is, is there a way to keep track of the user? For example in servlets we use sessions in order to store some user specific data. Is there something similar to it in web services? It seems impractical to have to authenticate the username and password each time the user sends a request to a web service. Thanks.
Upvotes: 1
Views: 63
Reputation: 6726
Web services may also use sessions, however there are good reasons to keep them stateless:
You do not have to use username+password for authentication. You may use JWT (or other kind of access tokens) to protect them.
Auth0 has got nice article on this topic: https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/
Upvotes: 1