Home Best practice for REST token-based authentication with JAX-RS and Jersey
Reply: 0

Best practice for REST token-based authentication with JAX-RS and Jersey

user765
1#
user765 Published in July 23, 2018, 1:39 pm

I'm looking for a way to enable token-based authentication in Jersey. I am trying not to use any particular framework. Is that possible?

My plan is: A user signs up for my web service, my web service generates a token, sends it to the client, and the client will retain it. Then the client, for each request, will send the token instead of username and password.

I was thinking of using a custom filter for each request and @PreAuthorize("hasRole('ROLE')") but I just thought that this causes a lot of requests to the database to check if the token is valid.

Or not create filter and in each request put a param token? So that each API first checks the token and after executes something to retrieve resource.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.385936 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO