KEYCLOAK-2469 Minor changes

This commit is contained in:
Stian Thorgersen 2016-03-21 15:45:53 +01:00
parent 204d226267
commit ce717fa20e
3 changed files with 15 additions and 10 deletions

View file

@ -19,13 +19,13 @@
<title>Clients</title> <title>Clients</title>
<para> <para>
Keycloak provides support for managing OAuth clients. Keycloak provides support for managing Clients.
</para> </para>
<section id="client-config"> <section id="client-config">
<title>Client Config</title> <title>Client Config</title>
<para> <para>
Keycloak supports flexible configuration of OAuth Clients. Keycloak supports flexible configuration of Clients.
</para> </para>
<section> <section>

View file

@ -116,7 +116,7 @@ public class RealmsResource {
* @param realmName * @param realmName
* @param clientId * @param clientId
* @return * @return
* @since 1.9 * @since 2.0
*/ */
@GET @GET
@Path("{realm}/clients/{client_id}/redirect") @Path("{realm}/clients/{client_id}/redirect")
@ -134,14 +134,19 @@ public class RealmsResource {
return null; return null;
} }
if (client.getRootUrl() == null) { if (client.getRootUrl() == null && client.getBaseUrl() == null) {
return null;
URI targetUri = KeycloakUriBuilder.fromUri(ResolveRelative.resolveRelativeUri(uriInfo.getRequestUri(), client.getRootUrl(), client.getBaseUrl())).build();
return Response.temporaryRedirect(targetUri).build();
} }
return Response.temporaryRedirect(URI.create(client.getRootUrl() + client.getBaseUrl())).build();
URI targetUri;
if (client.getRootUrl() != null && (client.getBaseUrl() == null || client.getBaseUrl().isEmpty())) {
targetUri = KeycloakUriBuilder.fromUri(client.getRootUrl()).build();
} else {
targetUri = KeycloakUriBuilder.fromUri(ResolveRelative.resolveRelativeUri(uriInfo.getRequestUri(), client.getRootUrl(), client.getBaseUrl())).build();
}
return Response.temporaryRedirect(targetUri).build();
} }
@Path("{realm}/login-actions") @Path("{realm}/login-actions")

View file

@ -17,7 +17,7 @@ import static org.junit.Assert.assertEquals;
/** /**
* @author <a href="mailto:thomas.darimont@gmail.com">Thomas Darimont</a> * @author <a href="mailto:thomas.darimont@gmail.com">Thomas Darimont</a>
*/ */
public class RealmResourceTest { public class ClientRedirectTest {
@ClassRule @ClassRule
public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() { public static KeycloakRule keycloakRule = new KeycloakRule(new KeycloakSetup() {