diff --git a/zuul-web/src/main/webapp/WEB-INF/jsp/settings/_viewGroup.jsp b/zuul-web/src/main/webapp/WEB-INF/jsp/settings/_viewGroup.jsp
index c247ea3..d34d2c9 100644
--- a/zuul-web/src/main/webapp/WEB-INF/jsp/settings/_viewGroup.jsp
+++ b/zuul-web/src/main/webapp/WEB-INF/jsp/settings/_viewGroup.jsp
@@ -95,7 +95,7 @@
-
+
-
diff --git a/zuul-web/src/main/webapp/assets/images/logins/aol.png b/zuul-web/src/main/webapp/assets/images/logins/aol.png
deleted file mode 100644
index e5a80e3..0000000
Binary files a/zuul-web/src/main/webapp/assets/images/logins/aol.png and /dev/null differ
diff --git a/zuul-web/src/main/webapp/assets/images/logins/flickr.png b/zuul-web/src/main/webapp/assets/images/logins/flickr.png
deleted file mode 100644
index 1e6f45c..0000000
Binary files a/zuul-web/src/main/webapp/assets/images/logins/flickr.png and /dev/null differ
diff --git a/zuul-web/src/main/webapp/assets/images/logins/verisign.png b/zuul-web/src/main/webapp/assets/images/logins/verisign.png
deleted file mode 100644
index 3a1262c..0000000
Binary files a/zuul-web/src/main/webapp/assets/images/logins/verisign.png and /dev/null differ
diff --git a/zuul-web/src/main/webapp/assets/js/json-form.js b/zuul-web/src/main/webapp/assets/js/json-form.js
index 7b86f51..af8e3c9 100644
--- a/zuul-web/src/main/webapp/assets/js/json-form.js
+++ b/zuul-web/src/main/webapp/assets/js/json-form.js
@@ -5,7 +5,6 @@
var dialog = null;
var onSave = null;
var onDelete = null;
- var onLoad = null;
var onError = function(xhr, status, error) {
try {
var json = $.parseJSON(xhr.responseText);
@@ -35,7 +34,6 @@
dialog = options.dialog;
onSave = options.onSave;
onDelete = options.onDelete;
- onLoad = options.onLoad;
if (dialog) {
registerButtonHandlers();
}
@@ -50,7 +48,6 @@
success:function (data, status, xhr) {
var binder = Binder.FormBinder.bind(form.get(0), data);
binder.deserialize();
- if (onLoad) onLoad(data);
},
error: onError
});
diff --git a/zuul-web/src/main/webapp/assets/js/settings-show.js b/zuul-web/src/main/webapp/assets/js/settings-show.js
index a636324..451450b 100644
--- a/zuul-web/src/main/webapp/assets/js/settings-show.js
+++ b/zuul-web/src/main/webapp/assets/js/settings-show.js
@@ -2,14 +2,25 @@ $(function () {
var dialog = $('#editEntryDialog').modal({show:false});
var link = null;
+ var updateEncryptLink = function(target, encrypted) {
+ target.data('encrypted', encrypted);
+ target.text(encrypted ? ' Decrypt ' : ' Encrypt ');
+ var icon = $(document.createElement('i')).addClass("icon-lock");
+ target.prepend(icon);
+ };
+
var toggleEncrypt = function () {
+ link = $(this);
var operation = link.data('encrypted') ? 'decrypt' : 'encrypt';
var id = link.data('id');
$.ajax({
url:getContextPath() + "/settings/entry/" + operation + ".json",
data:{id:id},
contentType:'application/json',
- success:onUpdateHandler,
+ success:function (data) {
+ updateEncryptLink(link, data.encrypted);
+ link.parents("tr").children(".value").text(data.value);
+ },
error: showJsonErrors
});
};
@@ -33,21 +44,13 @@ $(function () {
};
var onSaveHandler = function (entry) {
var row = link.parents("tr");
+ updateEncryptLink(link.parent().find(".encrypt-link"), entry.encrypted);
row.fadeOut('slow', function () {
row.children(".value").text(entry.value);
row.children(".key").text(entry.key);
});
row.fadeIn('slow');
};
- var onUpdateHandler = function(entry) {
- var encrypted = entry.encrypted;
- link.data('encrypted', encrypted);
- $("#value").val(entry.value).attr("readonly", encrypted);
- $("#encrypted").val(encrypted);
- $("#encryptToggle").
- toggleClass("btn-danger", !encrypted).find("i")
- .toggleClass("icon-white", !encrypted);
- };
var showEditDialog = function () {
link = $(this);
$('#editEntryDialog').modal('show');
@@ -93,9 +96,10 @@ $(function () {
};
- $("#encryptToggle").click(toggleEncrypt).tooltip({placement:'right', trigger:'hover'});
+ $("#encrypted").popover({placement:'right', trigger:'hover'});
$(".descriptive").popover({placement:'top', trigger:'hover'});
- $("#editEntryForm").jsonForm({ dialog:dialog, onSave:onSaveHandler, onDelete:onDeleteHandler, onLoad: onUpdateHandler });
+ $("#editEntryForm").jsonForm({ dialog:dialog, onSave:onSaveHandler, onDelete:onDeleteHandler });
+ $(".encrypt-link").click(toggleEncrypt);
$(".edit-link").click(showEditDialog);
$(".delete-link").click(deleteEntry);
$(".delete-group-link").click(deleteGroup);
diff --git a/zuul-web/src/test/groovy/org/devnull/zuul/web/OpenIdLoginControllerTest.groovy b/zuul-web/src/test/groovy/org/devnull/zuul/web/OpenIdLoginControllerTest.groovy
index 5d54766..1393391 100644
--- a/zuul-web/src/test/groovy/org/devnull/zuul/web/OpenIdLoginControllerTest.groovy
+++ b/zuul-web/src/test/groovy/org/devnull/zuul/web/OpenIdLoginControllerTest.groovy
@@ -13,31 +13,7 @@ public class OpenIdLoginControllerTest {
@Test
void shouldHaveLoginPage() {
- def modelView = controller.login()
- assert modelView.viewName == "/login/openid"
- verifyProviderMap(modelView.model.providers)
- }
-
- @Test
- void shouldLoadOpenIdProviders(){
- def providers = controller.getProviders()
- verifyProviderMap(providers)
- }
-
- private void verifyProviderMap(providers) {
- assert providers != null
- assert providers.size() == 4
- assert providers[0].name == "Google"
- assert providers[0].openIdUrl == "https://www.google.com/accounts/o8/id"
- assert providers[0].iconLocation == "google.png"
- assert providers[1].name == "Yahoo!"
- assert providers[1].openIdUrl == "https://me.yahoo.com/"
- assert providers[1].iconLocation == "yahoo.png"
- assert providers[2].name == "Verisign"
- assert providers[2].openIdUrl == "https://pip.verisignlabs.com/"
- assert providers[2].iconLocation == "verisign.png"
- assert providers[3].name == "Aol"
- assert providers[3].openIdUrl == "https://openid.aol.com"
- assert providers[3].iconLocation == "aol.png"
+ def view = controller.login()
+ assert view == "/login/openid"
}
}
diff --git a/zuul-web/src/test/groovy/org/devnull/zuul/web/SettingsServicesControllerTest.groovy b/zuul-web/src/test/groovy/org/devnull/zuul/web/SettingsServicesControllerTest.groovy
index 2c151b1..0527d78 100644
--- a/zuul-web/src/test/groovy/org/devnull/zuul/web/SettingsServicesControllerTest.groovy
+++ b/zuul-web/src/test/groovy/org/devnull/zuul/web/SettingsServicesControllerTest.groovy
@@ -131,20 +131,22 @@ class SettingsServicesControllerTest {
@Test
void shouldEncryptEntry() {
def expected = new SettingsEntry(id: 1, key: "a.b.c", value: "foo", encrypted: false)
- when(controller.zuulService.findSettingsEntry(expected.id)).thenReturn(expected)
- when(controller.zuulService.encryptSettingsEntryValue(expected)).thenReturn(expected)
+ when(controller.zuulService.encryptSettingsEntryValue(expected.id)).thenReturn(expected)
+ when(controller.zuulService.save(expected, SettingsAudit.AuditType.ENCRYPT)).thenReturn(expected)
def result = controller.encrypt(expected.id)
- verify(controller.zuulService).encryptSettingsEntryValue(expected)
+ verify(controller.zuulService).encryptSettingsEntryValue(expected.id)
+ verify(controller.zuulService).save(expected, SettingsAudit.AuditType.ENCRYPT)
assert result.is(expected)
}
@Test
void shouldDecryptEntry() {
def expected = new SettingsEntry(id: 1, key: "a.b.c", value: "foo", encrypted: true)
- when(controller.zuulService.findSettingsEntry(expected.id)).thenReturn(expected)
- when(controller.zuulService.decryptSettingsEntryValue(expected)).thenReturn(expected)
+ when(controller.zuulService.decryptSettingsEntryValue(expected.id)).thenReturn(expected)
+ when(controller.zuulService.save(expected, SettingsAudit.AuditType.DECRYPT)).thenReturn(expected)
def result = controller.decrypt(expected.id)
- verify(controller.zuulService).decryptSettingsEntryValue(expected)
+ verify(controller.zuulService).decryptSettingsEntryValue(expected.id)
+ verify(controller.zuulService).save(expected, SettingsAudit.AuditType.DECRYPT)
assert result.is(expected)
}
diff --git a/zuul-web/src/test/groovy/org/devnull/zuul/web/security/SettingEntryEncryptSecurityIntegrationTest.groovy b/zuul-web/src/test/groovy/org/devnull/zuul/web/security/SettingEntryEncryptSecurityIntegrationTest.groovy
index 83ae50f..89bc277 100644
--- a/zuul-web/src/test/groovy/org/devnull/zuul/web/security/SettingEntryEncryptSecurityIntegrationTest.groovy
+++ b/zuul-web/src/test/groovy/org/devnull/zuul/web/security/SettingEntryEncryptSecurityIntegrationTest.groovy
@@ -23,15 +23,14 @@ class SettingEntryEncryptSecurityIntegrationTest extends SecurityWebIntegrationT
loginAsUser(LOGIN_ROLE_ADMIN)
def entry = findUnRestrictedGroup().entries.first()
def unencrypted = entry.value
- assert settingsServicesController.encrypt(entry.id).value != unencrypted
- assert settingsEntryDao.findOne(entry.id).value == unencrypted
+ settingsServicesController.encrypt(entry.id)
+ assert settingsEntryDao.findOne(entry.id).value != unencrypted
}
@Test(expected = AccessDeniedException)
void shouldNotAllowRoleAdminToEncryptEntryBelongingToRestrictedGroup() {
loginAsUser(LOGIN_ROLE_ADMIN)
def entry = findRestrictedGroup().entries.first()
- assert entry.group
settingsServicesController.encrypt(entry.id)
}
@@ -40,8 +39,8 @@ class SettingEntryEncryptSecurityIntegrationTest extends SecurityWebIntegrationT
loginAsUser(LOGIN_ROLE_SYSTEM_ADMIN)
def entry = findRestrictedGroup().entries.first()
def unencrypted = entry.value
- assert settingsServicesController.encrypt(entry.id).value != unencrypted
- assert settingsEntryDao.findOne(entry.id).value == unencrypted
+ settingsServicesController.encrypt(entry.id)
+ assert settingsEntryDao.findOne(entry.id).value != unencrypted
}
}
|