r/SpringBoot • u/saltysnailsss • Oct 18 '24
Why would Spring generate for me a security password and I already have my custom implementation
3
u/Master_Carrot_9631 Oct 18 '24
You can try adding the @EnableWebSecurity annotation to your configuration file
1
u/saltysnailsss Oct 18 '24
I've already done that but still not working
1
u/Master_Carrot_9631 Oct 18 '24
Have you created a custom filter chain bean?
1
u/saltysnailsss Oct 18 '24
https://imgur.com/gallery/zepqkkv
yeah you can view in the link above
2
u/Master_Carrot_9631 Oct 18 '24
There is no custom filter chain bean in the link provided nor have you written the annotation I mentioned maybe you're providing a different link than the one you think.
1
u/saltysnailsss Oct 18 '24
there are 2 pics in the link, the custom filter chain is in the 2nd pic
1
u/Master_Carrot_9631 Oct 18 '24
Try creating an autowired constructor for the provider as well as the jwt filter maybe it's causing some sort of issue. But other than that I cannot find anything else wrong in the code. I usually don't explicitly configure the authentication provider in the filter chain, instead I let spring do it for me in the background.
1
u/Master_Carrot_9631 Oct 18 '24
Is there a proper password encoder bean configured cause if its not spring goes back to its default settings.
1
1
1
u/Leos_Leo Oct 18 '24
Just today i had a similar problem if i understand you correctly. When you move those beans into a package that you depend n, you need to tell spring to scan these. I did so by adding @import({MyPackageClass.class}) at the Application class. Maybe you need to import all or just some of the beans in question, if you need to include multiple you could consider import one that the imports the other inside your library.
Hope this helps or you find a solution. Best wishes
1
u/saltysnailsss Oct 19 '24
yes you are right.. one has to instruct spring to scan the packages containing ones custom implementation
2
u/AMZ_script Oct 18 '24
You should use annotation spring enable security , that error is normal thus is how spring security works
1
1
1
u/reddit04029 Oct 18 '24
Itโs because of this dependency
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Replace that with spring secuirty if you want full control over your security.
4
u/g00glen00b Oct 18 '24
Can you show us your custom implementation?