trunghieu99tt / WhoWroteThisShit

https://whowrotethisshit.vercel.app/
MIT License
3 stars 0 forks source link

Spring Security: Authentication using JWT #3

Open utterances-bot opened 8 months ago

utterances-bot commented 8 months ago

Spring Security: Authentication using JWT

Spring Security: Authentication using JWT

https://whowrotethisshit.vercel.app/spring-security-authentication-using-jwt

ducanhkl commented 8 months ago

This is a very detailed tutorial, but I have a question. Can Dependency Injection (DI) be used within a JWT filter? I see some cases where it could be useful, such as checking the validity of a JWT token against another data source. Thank you in advance for your help.

trunghieu99tt commented 8 months ago

This is a very detailed tutorial, but I have a question. Can Dependency Injection (DI) be used within a JWT filter? I see some cases where it could be useful, such as checking the validity of a JWT token against another data source. Thank you in advance for your help.

Yes, in case you still want to declare the filter as a Spring Bean, you can tell Spring Boot to not register it with the container by declaring a FilterRegistrationBean bean and setting its enabled property to false. For example:

image