Web Service Authentication in Java EE

When developing a web service (hospital management system) using Java EE, is it necessary for each web service call to verify that the user is registered?

Which authentication method is the best JAAS, WS-Security, SAML, or a combination or using native tokens ?

+4
source share
2 answers

It all depends on how your web service will be implemented or it will be. If you have a choice, I would recommend using the REST approach, authenticate the user with some kind of login function, and then maintain a user session.

+1
source

You can use filters.

Here is an example of using filters:

http://viralpatel.net/blogs/2009/01/tutorial-java-servlet-filter-example-using-eclipse-apache-tomcat.html

Basically, you determine the URL to which you want to apply filters, the filter allows the user, and then calls chain.doFilter (request, response); to call the requested method after authorization.

You can also take a look at this authentication and authorization of the jax-rs web service

Personally, I use tokens for authorization.

+1
source

Source: https://habr.com/ru/post/1391021/


All Articles