<div dir="ltr"><div>Realm has to be a part of user account url. That's built into Keycloak server, and how its service endpoints are structured.<br></div><div><br></div>Within your application you can use HttpServletRequest attributes to get to KeycloakDeployment, which contains information about the realm your application was configured with:<div><br></div>KeycloakSecurityContext ctx = (KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName());<br>KeycloakDeployment deployment = ((RefreshableKeycloakSecurityContext) ctx).getDeployment();<br>String realm = deployment.getRealm();<div><br></div><div>You can now use this realm to construct user account URL. I'm not sure if this is part of our public API. There is realm on KeycloakSecurityContext, but that one is only available if user is currently logged in.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 19, 2016 at 9:17 PM, Bill Simakis <span dir="ltr"><<a href="mailto:smacksnr@hotmail.com" target="_blank">smacksnr@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Marko,<br>
<br>
Thanks but is there a way without having to hard-code the realm name? <br>
<br>
Thanks,<br>
<br>
Bill<br>
<div class="hm HOEnZb"><br>
----------------------------------------<br>
> Date: Tue, 16 Feb 2016 22:08:21 +0100<br>
> Subject: Re: [keycloak-user] User Account access from client<br>
> From: <a href="mailto:mstrukel@redhat.com">mstrukel@redhat.com</a><br>
> To: <a href="mailto:smacksnr@hotmail.com">smacksnr@hotmail.com</a><br>
> CC: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
</div><div class="HOEnZb"><div class="h5">><br>
> You can take a look at how example demo app does this:<br>
><br>
> <a href="https://github.com/keycloak/keycloak/blob/1.9.0.CR1/examples/demo-template/customer-app/src/main/webapp/customers/view.jsp#L16" rel="noreferrer" target="_blank">https://github.com/keycloak/keycloak/blob/1.9.0.CR1/examples/demo-template/customer-app/src/main/webapp/customers/view.jsp#L16</a><br>
><br>
> On Tue, Feb 16, 2016 at 5:44 PM, Bill Simakis <<a href="mailto:smacksnr@hotmail.com">smacksnr@hotmail.com</a>> wrote:<br>
>> I have a web app using the spring security adapter which I have successfully integrated for the authentication/Authorization with KeyCloak.<br>
>> We wanted to make the user's life a little easier by providing a link within our app to allow an authenticated user to go to their Account page in KeyCloak. As this link is realm specific, is there a way we could get the url dynamically?<br>
>><br>
>> Thanks<br>
>><br>
>> Bill<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>
</div></div></blockquote></div><br></div>