<div dir="ltr"><div>Hello Hristo,</div><div><br></div><div>you should be able to access a KeycloakSecurityContext from the (Servlet)HttpRequest:</div><div>KeycloakSecurityContext securityContext = (KeycloakSecurityContext) httpRequest.getAttribute(KeycloakSecurityContext.class.getName());</div><div>KeycloakSecurityContext gives you access to the IDToken as well as the AccessToken.</div><div><br></div><div>You should also be able to cast securityContext to RefreshableKeycloakSecurityContext. This gives you access to</div><div>the KeycloakDeployment configuration.</div><div>org.keycloak.adapters.RefreshableKeycloakSecurityContext#getDeployment</div><div><br></div><div>See:</div><div><a href="https://github.com/keycloak/keycloak/blob/master/examples/demo-template/database-service/src/main/java/org/keycloak/example/oauth/CustomerService.java#L48">https://github.com/keycloak/keycloak/blob/master/examples/demo-template/database-service/src/main/java/org/keycloak/example/oauth/CustomerService.java#L48</a></div><div><br></div><div>Cheers,</div><div>Thomas</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-29 20:43 GMT+02:00 Hristo Stoyanov <span dir="ltr"><<a href="mailto:hr.stoyanov@peruncs.com" target="_blank">hr.stoyanov@peruncs.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hi,<br>
I configure KC via my WF10 standalone.xml<br>
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? <br>
Any code sample is appreciated!</p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">/Hristo Stoyanov</p>
</font></span><br>_______________________________________________<br>
keycloak-user mailing list<br>
<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br></blockquote></div><br></div>