Advanced Spring Security - How to create multiple Spring Security Configurations

Sdílet
Vložit
  • čas přidán 19. 04. 2023
  • In this comprehensive tutorial, we'll guide you through the process of setting up and managing multiple Spring Security configurations for your applications. We will demonstrate real-world scenarios and best practices, ensuring that you understand the fundamentals of implementing various authentication and authorization schemes.
    🔗Resources & Links mentioned in this video:
    GitHub Repo: github.com/danvega/ssc
    👋🏻Connect with me:
    Website: www.danvega.dev
    Twitter: / therealdanvega
    Github: github.com/danvega
    LinkedIn: / danvega
    Newsletter: www.danvega.dev/newsletter
    SUBSCRIBE TO MY CHANNEL: bit.ly/2re4GH0 ❤️
  • Věda a technologie

Komentáře • 47

  • @benjaminpeljto7408
    @benjaminpeljto7408 Před 4 dny

    Thank you so much, I'm building an app as a university project and I needed separate UserDetails interface implementation for two entities. Tried everything with one configuration and went past your video (thought it's not what I'm searching for). Basically after spending 4 hours you helped me, definitely new sub :) I love Spring.

  • @informatik01
    @informatik01 Před 9 měsíci +1

    Really useful tutorial. Short and to the point.
    Thank you!

  • @marouaniAymen
    @marouaniAymen Před rokem +2

    Really thanks you for this series of videos about Spring Security, I start to understand it very well and appreciate how Spring Boot simplifies the security side of our applications.

  • @user-vg8wm1mw4p
    @user-vg8wm1mw4p Před 11 měsíci +2

    rare to see a good java content like what you are producting, congrats for that Dan.

  • @SleepThatBurns
    @SleepThatBurns Před 11 měsíci

    Found value? Holy moly...absolutely! Invaluable channel. Period.

  • @justreason5868
    @justreason5868 Před 8 měsíci

    Dan makes it look so easy. Thanks buddy!

  • @pad5724
    @pad5724 Před rokem

    Thank you, I need this topic these days..

  • @MradnanBIH
    @MradnanBIH Před 11 měsíci

    @Dan Vega
    Thank you very much for this very much useful video! You're doing good job, very clean and concise explanations. :)

  • @sleepycakeawake
    @sleepycakeawake Před rokem

    Thank you for nice content Dan!

  • @beryalex1798
    @beryalex1798 Před rokem

    Thank you Dan Vega

  • @gordanbakalar7441
    @gordanbakalar7441 Před 10 měsíci +2

    Thanks!

  • @MsPrettyg00d
    @MsPrettyg00d Před 4 měsíci

    Thank you so much ❤

  • @ddarkodev2923
    @ddarkodev2923 Před 11 měsíci +2

    I'm not getting why the apiSecurityFilterChain ("api/**") matches the "/h2-console"-request.
    15:19

  • @fusing17
    @fusing17 Před 5 měsíci

    Awesome video! Seems to me this way of decoupling might be useful if I wanna separate my security configurations for my SPA web client and mobile client since both requires different types of filters and possibly different oauth flow

  • @naim-cd9tx
    @naim-cd9tx Před měsícem

    really good work. thanks

  • @ankushanandjec
    @ankushanandjec Před 6 měsíci +1

    Great video and explanation Dan! It seems that for higher versions of Spring Boot (e.g. 3.1.5), securityFilterChain method has to be modified to specify appropriate MVC matcher. Would you know the reason behind the same? Also, what could be the probable fix?

  • @Luisow748
    @Luisow748 Před 7 měsíci

    Thanks! Sweet piece of cake!

  • @kenduraghav
    @kenduraghav Před 22 dny

    Really good and useful video.

  • @Trodix89
    @Trodix89 Před rokem

    Hi, thank's for this video, I just needed this for my work this week !
    Is it possible to do a video on Spring Security ACL with Domain Object Security ?
    Have a good day !

  • @saravanavel2802
    @saravanavel2802 Před rokem

    Hi Dan. Thank you for enlightening with new tech advances in spring. However, looks like antmatcher is deprecated. But you are using it?

  • @hasseneayoub4818
    @hasseneayoub4818 Před 10 měsíci

    Hey Dan thank you for this awesome tutorial. I'm not finding the annotation @SecurityMatcher can you help me with that.

  • @chrispure7461
    @chrispure7461 Před 10 měsíci

    Great. Can you also explain how to handle 2 different authorization servers like jwt token can be from Keycloak auth server or Spring Auth server?

  • @TheGuroguro12
    @TheGuroguro12 Před 5 měsíci +1

    useful, thank you!!! I applied this to your video with resource server with oauth, get token works with basic and API with bearer token

    • @DanVega
      @DanVega  Před 5 měsíci

      Glad it was helpful!

  • @zubayerahamed7771
    @zubayerahamed7771 Před 7 měsíci +1

    awesome.

    • @DanVega
      @DanVega  Před 7 měsíci

      Glad you think so!

  • @headshotmaster3401
    @headshotmaster3401 Před 2 měsíci

    good one! what's the theme of intelliJ? thanks!

  • @alefsousaaguiardaniel5472
    @alefsousaaguiardaniel5472 Před 8 měsíci +1

    I need to perform LDAP authentication and thus generate a JWT token, do you know how to do this?

  • @user-dx6zd2fk8s
    @user-dx6zd2fk8s Před 9 měsíci

    Why does one want to use spring jdbc over spring data jpa? And since we are here for security then what is the difference between oauth2 and spring security?

  • @alefsousaaguiardaniel5472
    @alefsousaaguiardaniel5472 Před 8 měsíci

    Which IDE are you using?

  • @GeoLimiar
    @GeoLimiar Před 7 měsíci

    thankssss

  • @rajeshhazari
    @rajeshhazari Před rokem

    Thanks Dan for this intro, do know what is required to handle this multiple authentication filter based on either header or query param, and for ex may be same endpoint /api/V1/auth/ for both authentications ?

    • @DanVega
      @DanVega  Před rokem

      I'll have to dig into that and see if it's possible. Can you give me an example of where you might want to do this?

  • @ILyaCyclone
    @ILyaCyclone Před rokem +2

    Thanks mister Dan. Could you please clarify: I couldn't quite catch why we needed to explicitly specify ant matcher for h2 path? The documentation 16:46 reads "if Spring MVC is in classpath". But we're in Spring Boot app, Spring MVC is obviously in classpath. Or is this about the fact that h2 console is a separate application and we kinda have to know whether it uses Spring MVC inside?

    • @DanVega
      @DanVega  Před rokem +1

      Just because we are in Spring Boot doesn't necessarily mean Spring MVC is on the classpath but in this case you are correct. The /h2-console is a web resource and not a mvc route like /api/posts is and that's why I am using an AntMatcher there.

  • @ajimulyadi8064
    @ajimulyadi8064 Před měsícem

    could you please make a video about spring security with oauth2 inside it,,and how does it look like if the be and fe place on different domain

  • @uigreseu5756
    @uigreseu5756 Před rokem +2

    Hi Dan. You are doing a great job by explaining updates after 2.7.0 springBoot version. Could you explain please why I can still access secured pages even after I logged out? and how It could be fixed? thanks

    • @DanVega
      @DanVega  Před rokem

      In the example that I posted if you try and access /private you will be redirected to a login page. Do you have an example repo where this problem is happening?

    • @uigreseu5756
      @uigreseu5756 Před rokem

      @@DanVega Sorry but I don't have a repo but I will, put here how I've configure securityFilterchain(HttpSecurity http):
      public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
      http
      .csrf().disable()
      .authorizeRequests()
      .antMatchers("/addNewUser").permitAll()
      .antMatchers("/addNewDog").authenticated()
      .antMatchers("/getAllUsers").hasRole("ADMIN")
      .antMatchers("/getAllDogs").hasAnyRole("USER", "ADMIN")
      .antMatchers(" /dog/{dogId}/user/{userId}").hasRole("USER")
      .and()
      .formLogin()
      .and()
      .logout().permitAll()
      .deleteCookies("dummyCookies")
      .and()
      .authenticationProvider(daoAuthenticationProvider())
      .httpBasic();
      return http.build();
      }

    • @maziartary
      @maziartary Před rokem

      Perfect... I love your content...You just don't paste some functions but explain the idea and methods to implement it. I'll follow up upcoming posts. I believe you gonna have a reference channel with million subscribers. Thank you.

  • @mubarakahmed9060
    @mubarakahmed9060 Před rokem

    Greate

  • @rydmerlin
    @rydmerlin Před rokem

    If you are qualifying the path why is order annotation still needed?

  • @lukestardoinstuff1237
    @lukestardoinstuff1237 Před 4 měsíci

    I wish i would have watched this video before writing my Rest api with the help of outdated code while still learning the framework. Now i have to spend my day migrating all of my code to a newer version of spring just because i wanted to build some basic Security. btw. its not that bad. Im just frustrated because i spent multiple hours trying to even understand why nothing works.

  • @jopadjr
    @jopadjr Před rokem

    56th...Thanks Dan

  • @aibardulatov
    @aibardulatov Před 9 měsíci

    When I run application I get error
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postController' defined in file [/Users/aibar/IdeaProjects/Advanced-Spring-Security/target/classes/com/example/Advanced/Spring/Security/controllers/PostController.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'postRepository'