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 ]
Man, you're a life saver. Big Up.
Thank you very much
This video is suggested by Bing AI when I was asking for specific query and it really helps,
Thank you very much
Excellent Work ! Love from Tunisia
This video was very helpful, thanks!
Glad to hear it!
Unbelievable Work ! Love from Tunisia !
Thank you very much 😊
great tutorial, simple and easy to follow
Thank you bro
Excellent
thank you bro , working fine
Most welcome
Excellent!!!!!!
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
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.
The API’s are called by all clients and we have a uniform registration across all apps
Thank you very much. How update user?
You can call a method to update a user with the userId
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.
I don't have a tutorial for this functionality.
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.
May you please watch the latest complete video of Mastering Keycloak. All the issues were resolved well explained
@@CodeWithBisky thanks I will do
Thank you bro
You are welcome
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
Rename the file name to docker-compose.yml remove the mysq- prefix
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?
Did you manage to resolve this?
I just downloaded ur repository and controller send-verify-email isn't working. update password too
Follow tutorials for those features
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?
You can create a realm using admin portal.
Thank you very much. More tutorials are on the way
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
hey Bisky i got this error can u help me please Cannot invoke "java.security.Principal.getName()" because "principal" is null
Hey, are you accessing the endpoint with a valid token. You can post your issue in our discord channel
Hi.
47:44 - How can I implement the above query in Postman using the RestController?
same qus
You can copy the json from swagger and paste it on postman
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 😢
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
@@CodeWithBisky thanks
it helped :)
You are welcome. Enjoy coding
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?
May you please clone the project
@@CodeWithBiskyhow should I do it? You want me to put the spring boot project on my git?
Check the gitlab repository in the channel description and compare with you changes@@danielezappa3050
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.
Most welcome. Watch this video ruclips.net/video/cyQn6nRKLUM/видео.html
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?
You are welcome. I shall create a tutorial for that. We are supposed to use FeignClient.
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.
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
🤘
Thank you
Could i work with the 24.0.2 keycloack version ?
Yes it's ok that one
@@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 !!
Can i create client permission and policy using spring boot?
You can create roles and groups. I will have a tutorial for that.
im always get reponse 400 - bad request
Share the exception in our discord channel
Hi bisky! im always get reponse 401 - unauthorized with postman
Hi, make sure you are sending the correct client details you created. Take a look at the realm and clientId you are using.
@@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 ?
keycloak send event message