keycloak-scim/examples/admin-client/src/main/webapp/index.jsp

34 lines
1.2 KiB
Text
Raw Normal View History

2014-11-04 09:32:25 +00:00
<%@ page import="org.keycloak.admin.client.Keycloak" %>
<%@ page import="org.keycloak.admin.client.resource.ClientsResource" %>
<%@ page import="org.keycloak.common.util.UriUtils" %>
<%@ page import="org.keycloak.representations.idm.ClientRepresentation" %>
2014-11-04 09:32:25 +00:00
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%@ page session="false" %>
<html>
<head>
<title>Applications</title>
</head>
<body>
<%
String authServer = UriUtils.getOrigin(request.getRequestURL().toString()) + "/auth";
Keycloak keycloak = Keycloak.getInstance(authServer, "example", "examples-admin-client", "password", "examples-admin-client", "password");
2015-05-04 09:55:09 +00:00
ClientsResource clients = keycloak.realm("example").clients();
2014-11-04 09:32:25 +00:00
out.println("<h1>Applications</h1>");
out.println("<ul>");
2015-05-04 09:55:09 +00:00
for (ClientRepresentation client : clients.findAll()) {
2014-11-04 09:32:25 +00:00
out.println("\t<li>");
2015-05-04 09:55:09 +00:00
if (client.getBaseUrl() != null) {
out.println("\t\t<a href=\"" + client.getBaseUrl() + "\">" + client.getClientId() + "</a>");
2014-11-04 09:32:25 +00:00
} else {
2015-05-04 09:55:09 +00:00
out.println("\t\t" + client.getClientId());
2014-11-04 09:32:25 +00:00
}
out.println("</li>");
}
out.println("</ul>");
%>
<br><br>
</body>
</html>