You can use :
Keycloak.tokenManager().getAccessTokenString()
An then you pass it in the header of your request , for instance :
https://github.com/keycloak/keycloak/blob/master/examples/demo-template/p...
And use your String here :
https://github.com/keycloak/keycloak/blob/master/examples/demo-template/p...
On Fri, Oct 7, 2016 at 7:37 PM, Charles Moulliard <cmoullia(a)redhat.com>
wrote:
Hi,
I would like in a project to perform the following scenario
A Java HTTP Client calls a HTTP Endpoint exposed by WildFly Swarm where the
address URL ("/rest/say") of the endpoint is secured using Keycloak WildFly
plugin (keycloak.json contains the OIC).
In order at the client side to get the OpenID token that I must send next
to the endpoint using "Authentication: Bearer", is it this class that I
must use to get an instance of Keycloak
Keycloak.getInstance("http/localhost:8080/auth",realm, username, password,
clientId)
& next the token to send
Keycloak.tokenManager().grantToken();
?
Class -->
https://github.com/keycloak/keycloak/blob/2.2.1.Final/
integration/admin-client/src/main/java/org/keycloak/admin/
client/Keycloak.java
Regards
Charles
_______________________________________________
keycloak-user mailing list
keycloak-user(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user