How to get user Information by keycloak-admin-client
This article introduces the knowledge of "how to obtain user information from keycloak-admin-client". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Keycloak-admin-client is only a layer of encapsulation of the official interface, and it feels like it is based on Keycloak for secondary development. Generally, to obtain user information or token, you only need to use OpenID Endpoint Configuration. If you only integrate Keycloak, you can directly use the official adapter.
Keycloak keycloak = Keycloak.getInstance (serverUrl,realm,clientId,authToken)
UserRepresentation clients = keycloak.realm (realm). Users (). Get (uid). ToRepresentation ()
Log.info (clients.toString ())
Keycloak keycloak = KeycloakBuilder.builder ()
.serverUrl ("xxxx")
.realm ("xxxx")
.clientId ("xxx")
.clients (token)
.build ()
UserRepresentation clients = keycloak.realm (realm). Users (). Get (uid). ToRepresentation ()
Log.info (clients.toString ())
Reference address:
Https://github.com/keycloak/keycloak/blob/master/examples/admin-client/src/main/webapp/index.jsp
Https://www.keycloak.org/docs/latest/server_development/index.html#admin-rest-api
Https://github.com/keycloak/keycloak-quickstarts/blob/latest/app-authz-rest-springboot/src/test/java/org/keycloak/quickstart/springboot/MyAppTest.java
That's all for the content of "how to get user Information from keycloak-admin-client". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!