keycloak-aplcache
Changes
ui/pom.xml 19(+5 -14)
ui/src/main/java/org/keycloak/ui/example/Admin.java 105(+105 -0)
ui/src/main/resources/META-INF/resources/ui/js/services.js 396(+154 -242)
Details
ui/pom.xml 19(+5 -14)
diff --git a/ui/pom.xml b/ui/pom.xml
index 336ae80..db4e42d 100755
--- a/ui/pom.xml
+++ b/ui/pom.xml
@@ -13,19 +13,10 @@
<description />
<dependencies>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</project>
ui/src/main/java/org/keycloak/ui/example/Admin.java 105(+105 -0)
diff --git a/ui/src/main/java/org/keycloak/ui/example/Admin.java b/ui/src/main/java/org/keycloak/ui/example/Admin.java
new file mode 100644
index 0000000..ce064bb
--- /dev/null
+++ b/ui/src/main/java/org/keycloak/ui/example/Admin.java
@@ -0,0 +1,105 @@
+package org.keycloak.ui.example;
+
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@ApplicationPath("ui/api")
+@Path("")
+public class Admin extends javax.ws.rs.core.Application {
+
+ private static Map<String, Realm> realms = new HashMap<String, Realm>();
+
+ private static Map<String, Application> applications = new HashMap<String, Application>();
+
+ @DELETE
+ @Path("/applications/{key}")
+ public void delete(@PathParam("key") String applicationKey) {
+ applications.remove(applicationKey);
+ }
+
+ @DELETE
+ @Path("/realms/{key}")
+ public void deleteRealm(@PathParam("key") String key) {
+ realms.remove(key);
+ }
+
+ @GET
+ @Path("/applications/{key}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Application getApplication(@PathParam("key") String applicationKey) {
+ return applications.get(applicationKey);
+ }
+
+ @GET
+ @Path("/applications")
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<Application> getApplications() {
+ return new LinkedList<Application>(applications.values());
+ }
+
+ @GET
+ @Path("/realms/{key}")
+ @Produces(MediaType.APPLICATION_JSON)
+ public Realm getRealm(@PathParam("key") String key) {
+ return realms.get(key);
+ }
+
+
+ @GET
+ @Path("/realms")
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<Realm> getRealms() {
+ return new LinkedList<Realm>(realms.values());
+ }
+
+ @POST
+ @Path("/applications")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response save(Application application) {
+ String key = UUID.randomUUID().toString();
+ application.setKey(key);
+ applications.put(key, application);
+ return Response.created(URI.create("/applications/" + application.getKey())).build();
+ }
+
+ @POST
+ @Path("/realms")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response save(Realm realm) {
+ String key = UUID.randomUUID().toString();
+ realm.setKey(key);
+ realms.put(key, realm);
+ return Response.created(URI.create("/realms/" + realm.getKey())).build();
+ }
+
+ @PUT
+ @Path("/applications/{key}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public void save(@PathParam("key") String applicationKey, Application application) {
+ applications.put(applicationKey, application);
+ }
+
+ @PUT
+ @Path("/realms/{key}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ public void save(@PathParam("key") String key, Realm realm) {
+ realms.put(key, realm);
+ }
+}
\ No newline at end of file
diff --git a/ui/src/main/java/org/keycloak/ui/example/Application.java b/ui/src/main/java/org/keycloak/ui/example/Application.java
new file mode 100644
index 0000000..c110036
--- /dev/null
+++ b/ui/src/main/java/org/keycloak/ui/example/Application.java
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.ui.example;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
+ */
+@XmlRootElement
+public class Application {
+
+ private String callbackUrl;
+
+ private String key;
+
+ private String name;
+
+ private String owner;
+
+ private String javaScriptOrigin;
+
+ private List<IdentityProviderConfig> providers;
+
+ private String secret;
+
+ private String realm;
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public String getJavaScriptOrigin() {
+ return javaScriptOrigin;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public List<IdentityProviderConfig> getProviders() {
+ return providers;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public String getRealm() {
+ return realm;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ public void setJavaScriptOrigin(String javaScriptOrigin) {
+ this.javaScriptOrigin = javaScriptOrigin;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+ public void setProviders(List<IdentityProviderConfig> providers) {
+ this.providers = providers;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+ public void setRealm(String realm) {
+ this.realm = realm;
+ }
+
+}
diff --git a/ui/src/main/java/org/keycloak/ui/example/IdentityProviderConfig.java b/ui/src/main/java/org/keycloak/ui/example/IdentityProviderConfig.java
new file mode 100644
index 0000000..bd8e767
--- /dev/null
+++ b/ui/src/main/java/org/keycloak/ui/example/IdentityProviderConfig.java
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.ui.example;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
+ */
+@XmlRootElement
+public class IdentityProviderConfig {
+
+ private Long id;
+
+ private String key;
+
+ private String providerId;
+
+ private String secret;
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getProviderId() {
+ return providerId;
+ }
+
+ public String getSecret() {
+ return secret;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public void setProviderId(String providerId) {
+ this.providerId = providerId;
+ }
+
+ public void setSecret(String secret) {
+ this.secret = secret;
+ }
+
+}
diff --git a/ui/src/main/java/org/keycloak/ui/example/Realm.java b/ui/src/main/java/org/keycloak/ui/example/Realm.java
new file mode 100644
index 0000000..0153521
--- /dev/null
+++ b/ui/src/main/java/org/keycloak/ui/example/Realm.java
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.keycloak.ui.example;
+
+
+/**
+ * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
+ */
+public class Realm {
+
+ private String key;
+
+ private String name;
+
+ private String owner;
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setOwner(String owner) {
+ this.owner = owner;
+ }
+
+}
diff --git a/ui/src/main/resources/META-INF/resources/example-applications.js b/ui/src/main/resources/META-INF/resources/example-applications.js
new file mode 100644
index 0000000..410c365
--- /dev/null
+++ b/ui/src/main/resources/META-INF/resources/example-applications.js
@@ -0,0 +1,24 @@
+[ {
+ "callbackUrl" : "http://localhost:8080/test",
+ "key" : "7301af66-c481-4f54-a280-16529e11a153",
+ "name" : "Foo application",
+ "owner" : "root",
+ "javaScriptOrigin" : null,
+ "providers" : [ {
+ "id" : 7,
+ "key" : "google-key",
+ "providerId" : "google",
+ "secret" : "google-secret"
+ } ],
+ "secret" : "77f78140-e0ee-4912-a504-32c51180e918",
+ "realm" : "5ee722cc-7bdb-49fe-b76c-8b246e699065"
+}, {
+ "callbackUrl" : "http://localhost:8080/bar",
+ "key" : "f3ab7d43-7737-4507-a7a8-2e261f77298d",
+ "name" : "Bar application",
+ "owner" : "root",
+ "javaScriptOrigin" : null,
+ "providers" : [],
+ "secret" : "7d833773-d1e9-41f3-8749-8698f4c5ed03",
+ "realm" : "7d01c3cd-f483-414b-a02f-c260815224cc"
+} ]
\ No newline at end of file