keycloak-uncached

cleanup

10/24/2014 1:00:34 PM

Changes

services/src/main/java/org/keycloak/services/resources/admin/ClientCertificateResource.java 284(+0 -284)

Details

diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js
index 9e9758a..07b59cc 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js
@@ -230,117 +230,6 @@ module.controller('ApplicationCertificateExportCtrl', function($scope, $location
     });
 });
 
-module.controller('ApplicationCertificateCtrl', function($scope, $location, $http, $upload, realm, application,
-                                                         ApplicationCertificate, ApplicationCertificateGenerate,
-                                                         ApplicationCertificateDownload, Notifications) {
-    $scope.realm = realm;
-    $scope.application = application;
-    var jks = {
-        keyAlias: application.name,
-        realmAlias: realm.realm
-    };
-
-    $scope.files = [];
-
-    $scope.onFileSelect = function($files) {
-        $scope.files = $files;
-    };
-
-    $scope.clearFileSelect = function() {
-        $scope.files = null;
-    }
-
-    $scope.keyFormats = [
-        "JKS",
-        "PKCS12"
-    ];
-
-    $scope.jks = jks;
-    $scope.jks.format = $scope.keyFormats[0];
-    $scope.uploadKeyFormat = $scope.keyFormats[0];
-
-    $scope.uploadFile = function() {
-        //$files: an array of files selected, each file has name, size, and type.
-        for (var i = 0; i < $scope.files.length; i++) {
-            var $file = $scope.files[i];
-            $scope.upload = $upload.upload({
-                url: authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/certificates/upload/jks',
-                // method: POST or PUT,
-                // headers: {'headerKey': 'headerValue'}, withCredential: true,
-                data: {keystoreFormat: $scope.uploadKeyFormat,
-                       keyAlias: $scope.uploadKeyAlias,
-                       keyPassword: $scope.uploadKeyPassword,
-                       storePassword: $scope.uploadStorePassword
-                },
-                file: $file
-                /* set file formData name for 'Content-Desposition' header. Default: 'file' */
-                //fileFormDataName: myFile,
-                /* customize how data is added to formData. See #40#issuecomment-28612000 for example */
-                //formDataAppender: function(formData, key, val){}
-            }).progress(function(evt) {
-                console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total));
-            }).success(function(data, status, headers) {
-                $scope.keyInfo = data;
-                Notifications.success("Keystore uploaded successfully.");
-            })
-                .error(function() {
-                    Notifications.error("The key store can not be uploaded. Please verify the file.");
-
-                });
-            //.then(success, error, progress);
-        }
-    };
-
-
-
-
-    var keyInfo = ApplicationCertificate.get({ realm : realm.realm, application : application.id },
-        function() {
-            $scope.keyInfo = keyInfo;
-        }
-    );
-
-    $scope.generate = function() {
-        var keyInfo = ApplicationCertificateGenerate.generate({ realm : realm.realm, application : application.id },
-            function() {
-                Notifications.success('Client keypair and cert has been changed.');
-                $scope.keyInfo = keyInfo;
-            },
-            function() {
-                Notifications.error("Client keypair and cert was not changed due to a problem.");
-            }
-        );
-    };
-
-    $scope.downloadJKS = function() {
-        $http({
-            url: authUrl + '/admin/realms/' + realm.realm + '/applications-by-id/' + application.id + '/certificates/download',
-            method: 'POST',
-            responseType: 'arraybuffer',
-            data: $scope.jks,
-            headers: {
-                'Content-Type': 'application/json',
-                'Accept': 'application/octet-stream'
-            }
-        }).success(function(data){
-            var blob = new Blob([data], {
-                type: 'application/octet-stream'
-            });
-            var ext = ".jks";
-            if ($scope.jks.format == 'PKCS12') ext = ".p12";
-            saveAs(blob, 'keystore' + ext);
-        }).error(function(){
-            Notifications.error("Error downloading.");
-        });
-    }
-
-    $scope.$watch(function() {
-        return $location.path();
-    }, function() {
-        $scope.path = $location.path().substring(1).split("/");
-    });
-});
-
 module.controller('ApplicationSessionsCtrl', function($scope, realm, sessionCount, application,
                                                       ApplicationUserSessions) {
     $scope.realm = realm;
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientResource.java b/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientResource.java
index 4a03d08..63805e4 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/OAuthClientResource.java
@@ -24,6 +24,7 @@ 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.Context;
 import javax.ws.rs.core.MediaType;
@@ -72,9 +73,9 @@ public class OAuthClientResource  {
         return new ClaimResource(oauthClient, auth);
     }
 
-    @Path("certificates")
-    public ClientCertificateResource getCertficateResource() {
-        return new ClientCertificateResource(realm, auth, oauthClient, session);
+    @Path("certificates/{attr}")
+    public ClientAttributeCertificateResource getCertficateResource(@PathParam("attr") String attributePrefix) {
+        return new ClientAttributeCertificateResource(realm, auth, oauthClient, session, attributePrefix);
     }