Spring Boot 3 + Spring Security + JWT Authentication and Authorisation | RBAC | Rest API Example

Поділитися
Вставка
  • Опубліковано 3 лис 2023
  • Spring Boot 3 + Spring Security + JWT Authentication and Authorisation | RBAC | Rest API Example
    This video demonstrates how to protect your Spring boot Application as well as APIs via Spring Security to perform JWT authentication and authorization in a Spring Boot 3.
    You'll discover how simple it is to use JSON Web Tokens to secure your application and safeguard your endpoints. We'll go through some security rules for our application and configure Spring Security to use JWT. In the end, we'll verify our configuration by creating a basic API and sending authorised requests via Postman.
    This tutorial will provide you with the necessary tools to secure your Spring Boot application with JWT authentication and authorization, regardless of your level of experience as a developer.
    Spring Initialzr:
    start.spring.io/#!type=maven-...
    JWT IO:
    jwt.io/
    Recommendation:
    Spring Security:
    • UPDATED: Spring Securi...
    PLEASE SUPPORT THE CHANNEL:
    Donate from $5
    Link: paypal.me/cypcodestudios?coun...
    Thank you very much for watching. Please do Like and Subscribe
  • Наука та технологія

КОМЕНТАРІ • 22

  • @cypcode
    @cypcode  8 місяців тому

    Guys please do like and subscribe as 80% of views are not subscribed yet, subscribing is free as well as sharing, liking and commenting to motivate us to keep going. Thank you very much for watching

  • @andersontiban5356
    @andersontiban5356 8 місяців тому

    Nice

  • @user-gj1yr5mc3q
    @user-gj1yr5mc3q 8 місяців тому

    Hi , your videos are incredibly helpful, can you make a video for the deprecated "JdbcTokenStore" or share a link for the replacement of the same.I have read the spring security 6 guide but was unable to find anything regarding it. It will be really helpful . Thanks

  • @ganeshsingh3390
    @ganeshsingh3390 6 місяців тому

    Hey I am new in Spring. Can you tell me why the jwt.secret stored in application.properties file?? Is it safe to store the secret in properties file. Thankyou!!

    • @lemmestealyomum6563
      @lemmestealyomum6563 6 місяців тому

      As it was for a tutorial it is okay, but for real world applications do not store secret key in application.properties, it is not secure

    • @lemmestealyomum6563
      @lemmestealyomum6563 6 місяців тому

      But I am talking from a enterprise project or a companies pov
      For your own projects you can store it anywhere you want

  • @RabiulIslam-lx1uc
    @RabiulIslam-lx1uc 8 місяців тому

    hardly wait for it with sourch code

    • @cypcode
      @cypcode  8 місяців тому

      Hi @Rabiullslam-lx1uc thank you for checking out the video, please see Git repo: github.com/cypcodestudio/rbacspring

  • @prathyusha3031
    @prathyusha3031 8 місяців тому

    hii I am getting header as null what to do for that

    • @cypcode
      @cypcode  8 місяців тому

      Hi @prathyusha3031 please make sure your Authorisation Type is Bearer Token and you have passed in the token that you received back when you were logging in. Once that is set it should be able to pickup your token and Authenticate correctly

  • @user-ps5hz6hb5i
    @user-ps5hz6hb5i 7 місяців тому +1

    Where can I find the repo?

    • @cypcode
      @cypcode  6 місяців тому

      Hi @user-ps5hz6hb5i thank you for checking out the video, please see Git repo: github.com/cypcodestudio/rbacspring

  • @luciensikapa6543
    @luciensikapa6543 8 місяців тому

    nice explanations. Please wold you mind sharing the source code?

    • @cypcode
      @cypcode  8 місяців тому

      Hi @luciensikapa6543 thank you for checking out the video, please see Git repo: github.com/cypcodestudio/rbacspring

  • @sujitkumar2196
    @sujitkumar2196 8 місяців тому +1

    Awesome,can you please source code it would be very helpful

    • @cypcode
      @cypcode  8 місяців тому +1

      Hi @sujitkumar2196 thank you for checking out the video, please see Git repo: github.com/cypcodestudio/rbacspring

  • @PgPbnsn
    @PgPbnsn 6 місяців тому

    this example completely ignores Spring Security architecture both for authentication and authorization. would not recommend it

  • @user-hz9pw1yb8w
    @user-hz9pw1yb8w 5 місяців тому

    Please share repository

    • @cypcode
      @cypcode  5 місяців тому +1

      Thank you for checking out the video, please see Git repo: github.com/cypcodestudio/rbacspring

  • @user-er9pc2or6b
    @user-er9pc2or6b 7 місяців тому +1

    Nice video, but I am getting {
    "sub": "admin",
    "role": [],
    "iss": "rbacspring",
    "exp": 1701690111,
    "iat": 1701672111
    } .. Role is empty.. but I loggedin as Admin. pls give the suggestion.

    • @cypcode
      @cypcode  7 місяців тому

      Hi @user-er9pc2or6b thatnk you very much for watching the video and for your question. That tells me that spring knows that you are a valid user but on your JWT creation you’re not adding the GrantedAuthorities please confirm where you’re adding that and we can address your issue

    • @gagansharma2794
      @gagansharma2794 6 місяців тому

      I was also getting the same issue but after debugging further, i found while creating user or registering user that time it's trying to fetch roles from ROLE table but ROLE table is empty. So 1st we have to add Roles in ROLE table then we are good to go.
      I think think concept missed by @cypcode.