[keycloak-user] RestEasy Client doesn't support logging in as a service account
Marc Spehlmann
marc at autonomic.ai
Tue Jan 15 18:28:01 EST 2019
I have tried to configure the RestEasy client to use a service account for one of my confidential clients. The Java code to configure the client looks like:
```
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
class Scratch {
public static void main(String[] args) {
final String server = "localhost:8082";
final String realm = "master";
final String clientSecret = "00000000-0000-0000-0000-000000000000";
final String clientId = "MyClient";
Keycloak keycloak = KeycloakBuilder.builder()
.serverUrl(server)
.realm(realm)
.clientId(clientId)
.clientSecret(clientSecret)
.build();
keycloak.realm("master")
.clients()
.findAll();
}
}
```
This will fail with the exception:
```
Exception in thread "main" java.lang.IllegalStateException: username required
at org.keycloak.admin.client.KeycloakBuilder.build(KeycloakBuilder.java:131)
at Scratch.main(scratch_41.java:17)
```
I have a workaround, but my question is, is there any plan to support service-accounts with the keycloak client?
More information about the keycloak-user
mailing list