cleanup
This commit is contained in:
1 parent
dba7864180
commit
1be070e34d
3 files changed
+4
-398
No files matched your search
-111
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user