<div dir="ltr"><div>Quick update - I did some further experiments with this...</div><div><br></div><div>I added /redirect path to the a org.keycloak.services.resources.RealmsResource</div><div>like: @Path("{realm}/{client-id}/redirect")</div><div>see code fragment below.</div><div><br></div><div>This allows keycloak to initiate a redirect to the browser with the actual</div><div>target url of the client. Other clients now only need to now the realm and clientId</div><div>to generate a link that eventually redirects to the target application.</div><div><br></div><div>Usage:</div><div>GET <a href="http://localhost:8081/auth/realms/master/launchpad/redirect">http://localhost:8081/auth/realms/master/launchpad/redirect</a> -> 302 response with location: <a href="http://apps.corp.local/launchpad">http://apps.corp.local/launchpad</a></div><div><br></div><div>Any chance to get this in as a PR?</div><div><br></div><div>Cheers,</div><div>Thomas</div><div><br></div><div> @GET</div><div> @Path("{realm}/{client-id}/redirect")</div><div> public Response getRedirect(final @PathParam("realm") String realmName, final @PathParam("client-id") String clientId) throws Exception{</div><div><br></div><div> RealmModel realm = init(realmName);</div><div><br></div><div> if (realm == null){</div><div> return null;</div><div> }</div><div><br></div><div> ClientModel client = realm.getClientByClientId(clientId);</div><div><br></div><div> if (client == null){</div><div> return null;</div><div> }</div><div><br></div><div> if (client.getRootUrl() == null){</div><div> return Response.temporaryRedirect(uriInfo.getAbsolutePathBuilder().replacePath(client.getBaseUrl()).build()).build();</div><div> }</div><div><br></div><div> return Response.temporaryRedirect(URI.create(client.getRootUrl() + client.getBaseUrl())).build();</div><div> }</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-05 16:23 GMT+01:00 Thomas Darimont <span dir="ltr"><<a href="mailto:thomas.darimont@googlemail.com" target="_blank">thomas.darimont@googlemail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hello,</div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2016-02-05 15:22 GMT+01:00 Thomas Raehalme <span dir="ltr"><<a href="mailto:thomas.raehalme@aitiofinland.com" target="_blank">thomas.raehalme@aitiofinland.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I understand this as well, but it has not been uncommon to encounter a situation where the user needs to know where to go next, because Keycloak doesn't have a link available. </blockquote><div><br></div></span><div>with a redirect facility as outlined above - one could render a link to the "$KEYCLOAK_BASE_URL/redirect" or </div><div>lookup the "default" client in order to render the client base url link with a proper label (client name).</div><div><br></div><div>Cheers,</div><div>Thomas </div></div><br><br></div></div>
</blockquote></div><br></div>