Hello Hristo,

you should be able to access a KeycloakSecurityContext from the (Servlet)HttpRequest:
KeycloakSecurityContext securityContext = (KeycloakSecurityContext) httpRequest.getAttribute(KeycloakSecurityContext.class.getName());
KeycloakSecurityContext gives you access to the IDToken as well as the AccessToken.

You should also be able to cast securityContext to RefreshableKeycloakSecurityContext. This gives you access to
the KeycloakDeployment configuration.
org.keycloak.adapters.RefreshableKeycloakSecurityContext#getDeployment

See:
https://github.com/keycloak/keycloak/blob/master/examples/demo-template/database-service/src/main/java/org/keycloak/example/oauth/CustomerService.java#L48

Cheers,
Thomas

2016-03-29 20:43 GMT+02:00 Hristo Stoyanov <hr.stoyanov@peruncs.com>:

Hi,
I configure KC via my WF10 standalone.xml
file rather than changing my war package. How do I obtain KeycloakDeployment instance in my app, so I can place rest calls as my service account, using the secret and app id?
Any code sample is appreciated!

/Hristo Stoyanov


_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user