如何以编程方式在领域中创建客户端

时间:2018-09-13 21:19:18

标签: java spring keycloak

我想使用Java应用程序在keycloak中以编程方式创建客户端。有什么办法吗? 这个解决方案对我不起作用,我也不是很了解

String token = "eyJhbGciOiJSUz...";

ClientRepresentation client = new ClientRepresentation();
client.setClientId(CLIENT_ID);

ClientRegistration reg = ClientRegistration.create()
    .url("http://localhost:8080/auth", "myrealm")
    .build();

reg.auth(Auth.token(token));

client = reg.create(client);

String registrationAccessToken = client.getRegistrationAccessToken();

0 个答案:

没有答案
相关问题