[Fixed] Spring Security WebSecurityConfigurerAdapter Deprecated

  Рет қаралды 55,721

Code Java

Code Java

Күн бұрын

Пікірлер
@bezbos
@bezbos Жыл бұрын
I'm really not a big fan of this change. Did anyone ask for this? I mean, just how many guide and tutorials did they break with this update. Spring Security is already very difficult to learn for beginners and first-time users, now it's just going to make it even more complicated.
@CodeJava
@CodeJava Жыл бұрын
I don't like those changes, too. You can stick with old Spring Boot / Spring Security version (spring boot 2.6.x), so you won't get this kind of headache.
@khanhtran1473
@khanhtran1473 Жыл бұрын
I totally agreed with you. I'm struggling to learn spring security with their new changes cause all the tutorial on youtube are outdated because of it.
@khanhtran1473
@khanhtran1473 Жыл бұрын
@@CodeJava I've read some documentation from Baeldung about spring boot starter parent and found out that you can specify the version of Spring Security you want to use by downgrading the spring-boot-starter-parent version to below 2.7.0. However, that would also downgrade the version of other things like JPA and Lombok,... which I really don't want to do. So I'm trying not to touch the spring-boot-starter-parent. I've tried to downgrade the spring-boot-starter-security version only, but it doesn't work. I would appreciate it if you could help me with this. Thanks.
@CodeJava
@CodeJava Жыл бұрын
@@khanhtran1473 just try different versions of Spring Security (Check on Maven central repo).
@pkp2023
@pkp2023 3 ай бұрын
He Dosent Work for you or your company.
@ajitkumarneeraj9374
@ajitkumarneeraj9374 2 жыл бұрын
Sir What to do with this method @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(authenticationProvider()); } Will it be the same or changes will be required, showing error
@CodeJava
@CodeJava 2 жыл бұрын
remove that method. It's no longer needed.
@italoleitao-sc1091
@italoleitao-sc1091 2 жыл бұрын
@@CodeJava How do I do to get the AuthenticationManager?
@mucizelerden
@mucizelerden 9 ай бұрын
Sevgili dostum, ingilizce bilmiyor olmama rağmen olayı anlamış olmam senin başarın Teşekkür ediyorum👍
@CodeJava
@CodeJava 9 ай бұрын
glad it helped.
@ktn4
@ktn4 2 жыл бұрын
Oh thank you for the update bro Nam
@CodeJava
@CodeJava 2 жыл бұрын
No problem
@lehienisbk
@lehienisbk Жыл бұрын
After login, back acs url has error 403. Please help me.
@MyBinaryLife
@MyBinaryLife 2 жыл бұрын
Does not work. @Bean public WebSecurityCustomizer webSecurityCustomizer() { return (web) -> web.ignore().antMatchers("/images/**", "/js/**", "/webjars/**"); } this doesnt do anything, as .ignore() method does not exist.
@ayael119
@ayael119 Жыл бұрын
Did you find a solution i have the same methode
@alberiinaciodasilva5313
@alberiinaciodasilva5313 2 жыл бұрын
how could I do to allow anyone to access a password reset page?
@NidhishGandhi
@NidhishGandhi Жыл бұрын
I removed extends WebSecurityConfigurerAdapter still getting this error: Caused by: java.lang.IllegalStateException: Found WebSecurityConfigurerAdapter as well as SecurityFilterChain. Please select just one.
@CodeJava
@CodeJava Жыл бұрын
there's still one exists. You must delete it.
@nidhishgandhi5982
@nidhishgandhi5982 Жыл бұрын
@@CodeJava I didn't find any. Can you pls tell some other class that indirect uses it
@TrungLe-re5so
@TrungLe-re5so Жыл бұрын
Seem like antMatchers is deprecated too. The server fail to start because the method antMatchers(String) is undefined for the type WebSecurity.IgnoredRequestConfigurer When I change to requestMatchers("/resources/static/**"), the server can start without error, but can't access all my files inside resources/static folder and all css are all gone. Need your guide. Thanks~
@CodeJava
@CodeJava Жыл бұрын
why do you do requestMatchers on static resources? They should be ignored in authentication and authorization.
@TrungLe-re5so
@TrungLe-re5so Жыл бұрын
@@CodeJava I can't find a way to ignored static resources because there is no web ignoring antMatchers in the new spring security 6.
@ayael119
@ayael119 Жыл бұрын
I have an error in websecuritycostmizer and also even after doing this changes k got this err while runing the app : org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration$WebSecurityEnablerConfiguration]: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.class] cannot be opened because it does not exist
@ponsenthilvel0000
@ponsenthilvel0000 4 ай бұрын
Also bro i am having 4 hall (eg: saloon or exam hall)in each hall there's time slot for every 1/2 hr . Customer or student can book wat hall they want at that time could any one help me using spring boot
@maheshbabunadigoti7050
@maheshbabunadigoti7050 2 жыл бұрын
Thanks for the update... I purchased this course nahm...do we have any videos regarding Java agent in this channel...
@CodeJava
@CodeJava 2 жыл бұрын
Glad to hear that. I don't have any video about Java agent.
@yasminnadia2691
@yasminnadia2691 2 жыл бұрын
Hi dear I'm recently doing my project by following you spring boot ultimate course. I followed this video and my deprecated problem is solved. but when I dont know how to convert this below code. I can not use authenticationManagerBuilder if I don't use "extends WebSecurityConfigurerAdapter" . I've tried following this video but everytime I enter right password it says either bad credential or user is disabled. Please help me converting this below code without WebSecurityConfigurerAdapter. @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(authenticationProvider()); }
@CodeJava
@CodeJava 2 жыл бұрын
kindly check new update in my article: www.codejava.net/frameworks/spring-boot/fix-websecurityconfigureradapter-deprecated
@bluex217
@bluex217 2 жыл бұрын
Still cannot find working example using DAOAuthenticationProvider
@CodeJava
@CodeJava 2 жыл бұрын
Check solution in my article here: www.codejava.net/frameworks/spring-boot/fix-websecurityconfigureradapter-deprecated
@bluex217
@bluex217 2 жыл бұрын
@@CodeJava Thank you! I wasted some time and didn't realize that I had a plain text password in the DB yet was using BCrypPasswordEncoder, but your solution helped me realize this :)
@vaishnavis639
@vaishnavis639 Жыл бұрын
Hi , Could you help me for replacing websecurityconfigureadapater deprecated in spring boot 2.7 versions
@CodeJava
@CodeJava Жыл бұрын
Oh, isn't that described in this video? You can also check my article here: www.codejava.net/frameworks/spring-boot/fix-websecurityconfigureradapter-deprecated
@chandnisudhan5893
@chandnisudhan5893 2 жыл бұрын
whether the Full working code is available for download? Utility and filter class is available?
@CodeJava
@CodeJava 2 жыл бұрын
you can get the full project code when you enroll my course here: www.udemy.com/course/spring-boot-e-commerce-ultimate
@chandnisudhan5893
@chandnisudhan5893 2 жыл бұрын
@@CodeJava is it handled with jwt spring security
@CodeJava
@CodeJava 2 жыл бұрын
@@chandnisudhan5893 no, it is not.
@chandnisudhan5893
@chandnisudhan5893 2 жыл бұрын
@@CodeJava can you pls add jwt security in coming video
@luisphan7403
@luisphan7403 Жыл бұрын
@Code Java i have full course but i can’t download.
@gaurrahul619
@gaurrahul619 5 ай бұрын
plz make seperate playlist for spring security 6
@CodeJava
@CodeJava 5 ай бұрын
Sure, I will.
@cesarramirez3300
@cesarramirez3300 Жыл бұрын
hi, does it still work today? because i am working with spring 2.7.x
@CodeJava
@CodeJava Жыл бұрын
sure, it will work. Did you try it out?
@cesarramirez3300
@cesarramirez3300 Жыл бұрын
​@@CodeJava Not yet, I'll try it today!
@ramsesgirala5422
@ramsesgirala5422 2 жыл бұрын
Hi, i'm having problems with Oauth2 and github, could you help me?
@CodeJava
@CodeJava 2 жыл бұрын
check this video: kzbin.info/www/bejne/qJTMfmmgaNiii9U
@dmeritano
@dmeritano 2 жыл бұрын
What language do you speak my friend? Anyway, very good video! Thank you
@CodeJava
@CodeJava 2 жыл бұрын
I know what you mean. Thanks anyway :)
@vickeykanchi6804
@vickeykanchi6804 Жыл бұрын
When I tried to extend with configure adapter I was getting error
@CodeJava
@CodeJava Жыл бұрын
what's the error? Kindly share full details.
@vickeykanchi6804
@vickeykanchi6804 Жыл бұрын
@@CodeJava when I tried that web security configure adapter by seeing this code i was getting error
@vickeykanchi6804
@vickeykanchi6804 Жыл бұрын
@@CodeJava is there any telegram channel so that I can post a pic with error
@vickeykanchi6804
@vickeykanchi6804 Жыл бұрын
@@CodeJava unable to run it
@vickeykanchi6804
@vickeykanchi6804 Жыл бұрын
@@CodeJava ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt:
@ponsenthilvel0000
@ponsenthilvel0000 4 ай бұрын
Bro i need that full video for creation of shop me app is it e- commerce web ! Can I get that video link mainly for authorization video .... Do u have any comple video for e commerce website!
@CodeJava
@CodeJava 4 ай бұрын
yes, check this course: www.udemy.com/course/spring-boot-e-commerce-ultimate
@edakas
@edakas Жыл бұрын
in my code this solution does not work :(
@CodeJava
@CodeJava Жыл бұрын
I think you will find this article helpful: spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter
@FPT-LT
@FPT-LT 6 ай бұрын
Are you vietnamese right? I reconized from your ascent.
@CodeJava
@CodeJava 6 ай бұрын
yes, I am. Welcome to my Java channel :)
@ajitkumarneeraj9374
@ajitkumarneeraj9374 2 жыл бұрын
Sir your website is not working.
@CodeJava
@CodeJava 2 жыл бұрын
I see, it might be network issue on the server side. Kindly come back later. Thanks.
@ajitkumarneeraj9374
@ajitkumarneeraj9374 2 жыл бұрын
@@CodeJava Now Working.
@ziaurrahman9529
@ziaurrahman9529 2 жыл бұрын
thanks for the suggestion! , i will use it later and implement it to my app
@CodeJava
@CodeJava 2 жыл бұрын
Glad it was helpful!
@JRK_RIDES
@JRK_RIDES 2 жыл бұрын
Excellent video. Thank you sharing. I've one question, can you please help me rewrite the below method for latest spring security version? Or point me towards any guide or article or documentation. @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder); }
@CodeJava
@CodeJava 2 жыл бұрын
that method is no longer needed now. Reference: spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter
@pablobhz2008
@pablobhz2008 Жыл бұрын
@@CodeJava It is no longer needed, however the code won't work without it. It throws an exception missing a bean.
@vijaygv9332
@vijaygv9332 2 жыл бұрын
code git url please
@CodeJava
@CodeJava 2 жыл бұрын
check this article: www.codejava.net/frameworks/spring-boot/fix-websecurityconfigureradapter-deprecated
@rohan-san8148
@rohan-san8148 2 жыл бұрын
how to replace this pls : public void configure(AunthenticationManagerBuilder auth) throws Excetption { auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder);
@CodeJava
@CodeJava 2 жыл бұрын
just remove it and declare a bean of type PasswordEncoder. See this article: www.codejava.net/frameworks/spring-boot/fix-websecurityconfigureradapter-deprecated
@rohan-san8148
@rohan-san8148 2 жыл бұрын
@@CodeJava thank you
@jaymarkalvarez9851
@jaymarkalvarez9851 2 жыл бұрын
Amazing! thanks a lot. subbed
@CodeJava
@CodeJava 2 жыл бұрын
Thanks for the sub!
@johnstorm589
@johnstorm589 2 жыл бұрын
Am I the only one frowning at the WebSecurity lambda?
@CodeJava
@CodeJava 2 жыл бұрын
you're not. It returns an object of the type declared in the method's signature.
@MyBinaryLife
@MyBinaryLife 2 жыл бұрын
@@CodeJava it doesnt return anything or work at all. it warns that ignore doesnt exist, and breaks everything.
@brazo98
@brazo98 2 жыл бұрын
Perfect Nahm thx a lot 😻😻😻
@CodeJava
@CodeJava 2 жыл бұрын
You're welcome 😊
@samuelsodagudi
@samuelsodagudi Жыл бұрын
Many thanks 👍
@CodeJava
@CodeJava Жыл бұрын
Welcome 👍
@djmaster1110
@djmaster1110 Жыл бұрын
Thanks a lot
@CodeJava
@CodeJava Жыл бұрын
Happy to help
@markifive
@markifive 2 жыл бұрын
Thanks you for your code
@CodeJava
@CodeJava 2 жыл бұрын
You're welcome!
@congdatt
@congdatt Жыл бұрын
Thanks a lot bro ^^
@CodeJava
@CodeJava Жыл бұрын
You're welcome!
@gt-uj6fz
@gt-uj6fz 2 жыл бұрын
hello code Java, i copied your program "Spring Security JWT Authentication Tutorial" it worked with me. then i decided to try it without websecurityconfigureadapter, i copied every thing the video "Fixed] Spring Security WebSecurityConfigurerAdapter Deprecated' , the program gave me error at authenticationmanager. it looks like program does not recognize the authenticatiommanager, i also, noticed you did not specify any autnentictionmanager in the configuration part. i get the error at public ResponseEntity login(@RequestBody @Valid AuthRequest request) { try { Authentication authentication = authManager.authenticate( new UsernamePasswordAuthenticationToken( request.getEmail(), request.getPassword()) ); so any help will be appreciated. thanks
@CodeJava
@CodeJava 2 жыл бұрын
you can declare a bean of type AuthenticationManager like this: @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); }
@bluex217
@bluex217 2 жыл бұрын
​@@CodeJava Hey there! I've tried this but still it's not obvious how to 1. Set the AuthenticationProvider type using the AuthenticationManager 2. pass the AuthenticationManager into http.setAuthenticationManager() - I should just call the method from here? I tried autowiring as bean from another class but get circular reference exception
@CodeJava
@CodeJava 2 жыл бұрын
@@bluex217 check solution in my article: www.codejava.net/frameworks/spring-boot/fix-websecurityconfigureradapter-deprecated
@ahmedtiba386
@ahmedtiba386 2 жыл бұрын
in Authentification Controller @PostMapping("/authenticate") public ResponseEntity authenticate(@RequestBody AuthenticationRequest request){ authenticationManager.authenticate( new UsernamePasswordAuthenticationToken(request.getLogin(),request.getPassword()) ); ........ how i can change this code ?
@CodeJava
@CodeJava 2 жыл бұрын
Try this: @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception { return authenticationConfiguration.getAuthenticationManager(); }
@MinhNguyen-xf3in
@MinhNguyen-xf3in 2 жыл бұрын
@@CodeJava but in controller i cann't override AuthenticationManager
@udemytiengviet956
@udemytiengviet956 2 жыл бұрын
Thanks bro , that's really helpful But i have an issue : I can't call .antMatchers() after http.authorizeRequests(). Please help me. Many thanks
@CodeJava
@CodeJava 2 жыл бұрын
I don't know exactly why. Maybe you use newer version of Spring Security?
@pablobhz2008
@pablobhz2008 Жыл бұрын
Hello. Its deprecated. .antMatchers() has been replaced by .requestMatchers()
#29 Spring Security 6 | Getting Started
14:05
Telusko
Рет қаралды 26 М.
Гениальное изобретение из обычного стаканчика!
00:31
Лютая физика | Олимпиадная физика
Рет қаралды 4,8 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Spring Security without the WebSecurityConfigurerAdapter
17:08
Spring Security explained with no code
16:51
Bouali Ali
Рет қаралды 22 М.
Spring Boot Security - SecurityFilterChain
7:48
Teddy Smith
Рет қаралды 61 М.
Spring Security JPA Authentication in Spring Boot
40:04
Dan Vega
Рет қаралды 43 М.
Spring Security Architecture Explained
14:41
Amigoscode
Рет қаралды 118 М.