Rect
Rect

Reputation: 171

Can I get the request parameter at authentication time with spring security?

I have developed a java spring server with security and JWT. while developing, I got the question in the title because I should know the parameter value at authentication time. Unless it, I should send JWT as the parameter.

Can I get the request parameter without affecting get parameters in the controller at the authentication time?

Exactly, I wanna compare the JWT payload and some data.

Upvotes: 0

Views: 660

Answers (1)

Ken Chan
Ken Chan

Reputation: 90447

Sure. Spring Security is designed based on the standard Servlet Filter which is composed of a series of FilterChain for processing a HTTP request. Each filter in the chain is responsible for doing a particular thing such as authentication , authorization, session management, CSRF protection, exception handling etc...

Because of that , it means you can implement a Filter and play with the HttpServletRequest API to get the request parameter to validate JWT such as :

httpServletRequest.getHeader("xxxx");
httpServletRequest.getParameter("xxxxx");

Upvotes: 1

Related Questions