12. Keycloak Admin Client Spring Boot Integration: Creating New Users Tutorial

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • Keycloak Admin Client Spring Boot Integration: Creating New Users Tutorial
    Welcome to CodeWithBisky! In this tutorial, we'll guide you through the process of integrating Keycloak Admin Client with Spring Boot, allowing you to manage authentication and authorization in your Java applications effortlessly. Specifically, we'll focus on creating a new user using Keycloak Admin Client API.
    What You'll Learn:
    Setting up Keycloak Admin Client in Spring Boot
    Creating a new user programmatically using Keycloak Admin Client API
    Implementing authentication and authorization features in your Spring Boot applications
    Best practices for user management and security
    Prerequisites:
    Basic understanding of Spring Boot and Java programming
    Keycloak installed and configured on your system
    IDE (Eclipse, IntelliJ, etc.) installed for Java development
    Don't forget to like this video, subscribe to my channel for more exciting tutorials, and hit the notification bell to stay updated with future content. If you have any questions or need further clarification, please leave a comment below, and I'll be happy to assist you.
    #Keycloak #SpringBoot #JavaProgramming #Authentication #Authorization #UserManagement #ProgrammingTutorial #DeveloperGuide #APIIntegration #JavaDevelopers #WebDevelopment #Security #CodingTips #ProgrammingTips #OpenSource #SoftwareDevelopment #TechTutorial #CodeWithMe #DeveloperCommunity #LearnToCode #JavaApps #WebSecurity #KeycloakIntegration #ProgrammingJourney #CodingEducation #DeveloperLife #TechSolutions #CodeByExample #SoftwareEngineering #JavaProjects #CodeNewbie #codewithbisky
    BLOG: [codewithbisky....]
    Repository: [gitlab.com/cod...]
    Facebook: [ / codewithbisky ]
    Twitter: [ / codewithbisky ]

Комментарии • 69

  • @giuseppezappia9630
    @giuseppezappia9630 2 месяца назад +1

    Man, you're a life saver. Big Up.

  • @vikas4247
    @vikas4247 Месяц назад

    This video is suggested by Bing AI when I was asking for specific query and it really helps,

  • @MohamedAmineREGAIA
    @MohamedAmineREGAIA 6 месяцев назад +1

    Excellent Work ! Love from Tunisia

  • @christelledutoit
    @christelledutoit 7 месяцев назад +1

    This video was very helpful, thanks!

  • @khalilhermassi1439
    @khalilhermassi1439 9 месяцев назад +1

    Unbelievable Work ! Love from Tunisia !

  • @bmukorera
    @bmukorera 5 месяцев назад

    great tutorial, simple and easy to follow

  • @nadetdevfullstack7041
    @nadetdevfullstack7041 7 месяцев назад +1

    Excellent

  • @Ghrab1
    @Ghrab1 9 месяцев назад +1

    thank you bro , working fine

  •  6 месяцев назад

    Excellent!!!!!!

  • @ngbean4371
    @ngbean4371 Месяц назад

    Hi Thanks a lot Bisky for this incredible tutorials I have one question why we need to create our custom APIs for keycloak crud operations while we have keycloak login and register page

    • @CodeWithBisky
      @CodeWithBisky  Месяц назад +1

      We a need a way to centralize the registration without exposing credentials to the client.
      Think of iOS app, Android, web and having the credentials in every app. For security reasons we don’t have to do that in our client app. Server side is very secure.

    • @CodeWithBisky
      @CodeWithBisky  Месяц назад +1

      The API’s are called by all clients and we have a uniform registration across all apps

  • @evgeniybudaev1690
    @evgeniybudaev1690 29 дней назад

    Thank you very much. How update user?

    • @CodeWithBisky
      @CodeWithBisky  27 дней назад

      You can call a method to update a user with the userId

  • @Kimsunfang
    @Kimsunfang 5 месяцев назад

    Your video has been a great help. I have a question about the Capability Config settings that start at 7:20 in your video. I'd like to programmatically enable "Client authentication," "Direct access grants," and "Service accounts roles" using keycloak-admin-client. For example, when a Spring Boot application runs, I want it to automatically create a realm in Keycloak and activate the "Client authentication," "Direct access grants," and "Service accounts roles" options for that realm's admin-cli. Could you provide any references or assistance on this matter? I'm using both Keycloak and keycloak-admin-client version 24.0.2.

    • @CodeWithBisky
      @CodeWithBisky  5 месяцев назад

      I don't have a tutorial for this functionality.

  • @kbpmowrya
    @kbpmowrya 20 дней назад

    Out of 10 times, 6 times it is showing error "HTTP 500 Internal Server Error" when you create users and other api's are not working.

    • @CodeWithBisky
      @CodeWithBisky  20 дней назад +1

      May you please watch the latest complete video of Mastering Keycloak. All the issues were resolved well explained

    • @kbpmowrya
      @kbpmowrya 20 дней назад

      @@CodeWithBisky thanks I will do

  • @gandawaab75
    @gandawaab75 3 месяца назад

    Thank you bro

  • @HenazeriBoutique
    @HenazeriBoutique 9 месяцев назад

    how we can run docker compose in different environment? for example: you have mysql-docker-compose.yml and how we will run in the command line? cause docker-compose up getting the error

    • @CodeWithBisky
      @CodeWithBisky  9 месяцев назад +1

      Rename the file name to docker-compose.yml remove the mysq- prefix

  • @ones2dev196
    @ones2dev196 5 месяцев назад

    tutorial is really great, but when testing create user endpoint i always have 200 code and user is not creating, can anybody help me tp deal with it?

    • @CodeWithBisky
      @CodeWithBisky  5 месяцев назад

      Did you manage to resolve this?

  • @PAUL1430
    @PAUL1430 4 месяца назад

    I just downloaded ur repository and controller send-verify-email isn't working. update password too

    • @CodeWithBisky
      @CodeWithBisky  4 месяца назад

      Follow tutorials for those features

  • @chitranshsaxena6221
    @chitranshsaxena6221 7 месяцев назад

    Hey! Great video. Helped me a lot. Just wanna ask can we create Realms as well? If yes can we create Realms with the help of keycloak-realm.json(Realm Configuration) by sending it through api as a payload?

    • @CodeWithBisky
      @CodeWithBisky  7 месяцев назад

      You can create a realm using admin portal.
      Thank you very much. More tutorials are on the way

    • @chitranshsaxena6221
      @chitranshsaxena6221 7 месяцев назад

      what if I don't want to go to the admin portal/console? can we achieve this functionality from keycloak instance builder like you have used it for creating users? @@CodeWithBisky

  • @bitroxtn7385
    @bitroxtn7385 9 месяцев назад

    hey Bisky i got this error can u help me please Cannot invoke "java.security.Principal.getName()" because "principal" is null

    • @CodeWithBisky
      @CodeWithBisky  9 месяцев назад

      Hey, are you accessing the endpoint with a valid token. You can post your issue in our discord channel

  • @bohdanphoenix
    @bohdanphoenix 5 месяцев назад

    Hi.
    47:44 - How can I implement the above query in Postman using the RestController?

  • @SultanAliyev-s7w
    @SultanAliyev-s7w 10 месяцев назад

    Hello, great content
    How can I add roles to user in createUser() method?
    P.S I tried using user.setRealmRoles(List.of(“my_role”));
    But it didn’t add “my_role” role 😢

    • @CodeWithBisky
      @CodeWithBisky  10 месяцев назад +1

      You are welcome
      Check this commit of the new series gitlab.com/code-with-bisky/bisky-music/backend/auth-service/-/commit/b36310001039af40ed3ce8dc88fd6ef695afc1c6
      In this class KeycloakUserServiceImpl.java

    • @SultanAliyev-s7w
      @SultanAliyev-s7w 10 месяцев назад

      @@CodeWithBisky thanks
      it helped :)

    • @CodeWithBisky
      @CodeWithBisky  10 месяцев назад

      You are welcome. Enjoy coding

  • @danielezappa3050
    @danielezappa3050 6 месяцев назад

    Hi bisk! I followed your video to set up my spring boot application and integrating the users creation logic (I copied your Service, Config and Controller): Now I'm trying to create users calling the controller from a frontend endpoint but I receive a 400 Bad Request Http Error. Could you help me to resolve this problem?

    • @CodeWithBisky
      @CodeWithBisky  6 месяцев назад

      May you please clone the project

    • @danielezappa3050
      @danielezappa3050 6 месяцев назад

      @@CodeWithBiskyhow should I do it? You want me to put the spring boot project on my git?

    • @CodeWithBisky
      @CodeWithBisky  6 месяцев назад

      Check the gitlab repository in the channel description and compare with you changes@@danielezappa3050

  • @michaelajiri
    @michaelajiri 9 месяцев назад

    Hello Bisky, thank you so much for the tutorial. However, I am encountering an issue while deploying both the Keycloak 22.0.4 version and the latest version, 23.0.0. I utilized the Docker Compose file configuration specified in the 'spring-boot-third-application' that I cloned from GitLab. At some point, the Admin UI fails to load and continues spinning indefinitely. I have explored online solutions, but none have been successful.
    Could you please provide guidance on resolving this issue? Thank you.

    • @CodeWithBisky
      @CodeWithBisky  9 месяцев назад

      Most welcome. Watch this video ruclips.net/video/cyQn6nRKLUM/видео.html

    • @michaelajiri
      @michaelajiri 9 месяцев назад

      Thank you, Bisky. I have resolved the issue.
      I have a follow-up question. I have three standalone Spring Boot applications. One of them handles user registration with fully implemented Keycloak functionality, while the others are for address service and e-commerce service. I've created APIs for both the address service and e-commerce service. After a user logs in via Keycloak, I want to use the token to consistently access these APIs in the address service and e-commerce apps. Could you please direct me to any documentation or tutorial that could be helpful?

    • @CodeWithBisky
      @CodeWithBisky  9 месяцев назад

      You are welcome. I shall create a tutorial for that. We are supposed to use FeignClient.

    • @michaelajiri
      @michaelajiri 9 месяцев назад

      I would like to implement an additional functionality within this specification, wherein I aim to retrieve the user ID from Keycloak. Upon a user's successful login, I intend to utilize the token to obtain the current user's ID from Keycloak. This user ID will be stored for future use, allowing me to retrieve specific values associated with that user within my code.

    • @michaelajiri
      @michaelajiri 8 месяцев назад

      Hello Bisky, I am employing Keycloak as a single sign-on solution for my various Spring Boot applications. While making inter-service API calls from each application, how can I utilize the token associated with the user's sign-in to access an API from any of the external applications. My system is not a Micro service architecture they are just standalone springboot applications

  • @nurkandzhsupov6953
    @nurkandzhsupov6953 5 месяцев назад

    🤘

  • @IssamGharbi-o5y
    @IssamGharbi-o5y 5 месяцев назад

    Could i work with the 24.0.2 keycloack version ?

    • @CodeWithBisky
      @CodeWithBisky  5 месяцев назад

      Yes it's ok that one

    • @IssamGharbi-o5y
      @IssamGharbi-o5y 5 месяцев назад

      @@CodeWithBisky i had this error on testing the get and the delete user '' 500
      Undocumented
      Error: response status is 500
      Response body
      Download
      {
      "timestamp": "2024-04-01T02:12:05.196+00:00",
      "status": 500,
      "error": "Internal Server Error",
      "path": "/api/integration/users/userId"
      } "" your help please !!

  • @shubhamsoni4582
    @shubhamsoni4582 10 месяцев назад

    Can i create client permission and policy using spring boot?

    • @CodeWithBisky
      @CodeWithBisky  10 месяцев назад

      You can create roles and groups. I will have a tutorial for that.

  • @kyoshin7135
    @kyoshin7135 6 месяцев назад

    im always get reponse 400 - bad request

    • @CodeWithBisky
      @CodeWithBisky  6 месяцев назад

      Share the exception in our discord channel

  • @MohamedAmineREGAIA
    @MohamedAmineREGAIA 6 месяцев назад

    Hi bisky! im always get reponse 401 - unauthorized with postman

    • @CodeWithBisky
      @CodeWithBisky  6 месяцев назад +1

      Hi, make sure you are sending the correct client details you created. Take a look at the realm and clientId you are using.

    • @hocampro6176
      @hocampro6176 5 месяцев назад

      @@CodeWithBisky jakarta.ws.rs.NotAuthorizedException: HTTP 401 Unauthorized I take this error and my infos are true, how can I resolve this please help me ?

  • @ken-gg4vr
    @ken-gg4vr 3 месяца назад

    keycloak send event message