summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins/management-http
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2014-11-28 18:25:57 +0000
committerAlex Rudyy <orudyy@apache.org>2014-11-28 18:25:57 +0000
commit8e3c214a4650eb427d91ccde5ff2b28d242b1029 (patch)
treec4f8bd096d28409761fd97bde61c53e7b7e159aa /qpid/java/broker-plugins/management-http
parentbdd1d2ca94a74e34b862aafac8296d3fb2030c7d (diff)
downloadqpid-python-8e3c214a4650eb427d91ccde5ff2b28d242b1029.tar.gz
QPID-6246: [Java Broker] Refactor authentication provider UIs to use dedicated dialogues
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1642340 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http')
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAuthenticationProviderAttributes.java38
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html70
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html26
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/passwordfile/add.html31
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html29
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html129
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js4
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js8
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProviderFields.js192
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js352
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js113
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js37
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js37
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js22
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js37
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js66
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js77
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js190
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js35
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html37
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html62
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProviderFields.html41
29 files changed, 1062 insertions, 699 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
index cb41fd9203..1e795480fc 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
@@ -34,7 +34,6 @@ import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListAccessControlProviderAttributes;
-import org.apache.qpid.server.management.plugin.servlet.rest.action.ListAuthenticationProviderAttributes;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListBrokerAttribute;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListGroupProviderAttributes;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListTimeZones;
@@ -55,7 +54,6 @@ public class HelperServlet extends AbstractServlet
_mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
Action[] supportedActions = {
- new ListAuthenticationProviderAttributes(),
new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOSTNODE_TYPES, "ListVirtualHostNodeTypes"),
new ListBrokerAttribute(Broker.SUPPORTED_VIRTUALHOST_TYPES, "ListVirtualHostTypes"),
new ListBrokerAttribute(Broker.SUPPORTED_PREFERENCES_PROVIDER_TYPES, "ListPreferencesProvidersTypes"),
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAuthenticationProviderAttributes.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAuthenticationProviderAttributes.java
deleted file mode 100644
index 3e006a705a..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAuthenticationProviderAttributes.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *
- */
-package org.apache.qpid.server.management.plugin.servlet.rest.action;
-
-import org.apache.qpid.server.model.AuthenticationProvider;
-
-public class ListAuthenticationProviderAttributes extends AbstractSpecialisedAttributeLister<AuthenticationProvider>
-{
- @Override
- public String getName()
- {
- return ListAuthenticationProviderAttributes.class.getSimpleName();
- }
-
- @Override
- Class<AuthenticationProvider> getCategoryClass()
- {
- return AuthenticationProvider.class;
- }
-}
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html
index e90262f17b..ee9286e2f7 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html
@@ -15,32 +15,50 @@
~ limitations under the License.
-->
<div class="dijitHidden">
- <div data-dojo-type="dijit.Dialog" data-dojo-props="title:'Authentication Provider'" id="addAuthenticationProvider">
- <form id="formAddAuthenticationProvider" method="post" dojoType="dijit.form.Form">
- <div style="width:420px; overflow: auto">
- <table class="tableContainer-table tableContainer-table-horiz" width="100%" cellspacing="1">
- <tr>
- <td class="tableContainer-labelCell">Type*:</td>
- <td class="tableContainer-valueCell"><div id="addAuthenticationProvider.selectAuthenticationProviderDiv"></div></td>
- </tr>
- <tr>
- <td class="tableContainer-labelCell">Name*:</td>
- <td class="tableContainer-valueCell"><input type="text" required="true" name="name"
- id="formAddAuthenticationProvider.name" placeholder="Name"
- dojoType="dijit.form.ValidationTextBox" missingMessage="A name must be supplied" /></td>
- </tr>
- </table>
- <input type="hidden" id="formAddAuthenticationProvider.id" name="id"/>
- <div id="addAuthenticationProvider.fieldSets"></div>
- <br/>
- <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Preferences Provider', open: true" id="addAuthenticationProvider.preferencesProviderPanel">
- <div id="addAuthenticationProvider.preferencesProvider"></div>
+ <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Authentication Provider'" id="addAuthenticationProvider">
+ <div id="addAuthenticationProvider.contentPane">
+ <form id="addAuthenticationProvider.form" method="post" data-dojo-type="dijit/form/Form">
+ <div class="formBox">
+ <fieldset>
+ <legend>Authentication Provider</legend>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" id="addAuthenticationProvider.name"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'name',
+ placeHolder: 'authentication provider name',
+ required: true,
+ promptMessage: 'Name of authentication provider, must be unique',
+ title: 'Enter a unique authentication provider name per broker'" />
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div>
+ <div class="tableContainer-valueCell formLabel-controlCell">
+ <select id="addAuthenticationProvider.type" data-dojo-type="dijit/form/FilteringSelect"
+ data-dojo-props="
+ name: 'type',
+ required: true,
+ placeHolder: 'select authentication provider type',
+ promptMessage: 'Type of authentication provider',
+ title: 'Select authentication provider type',
+ searchAttr: 'name'">
+ </select>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div id="addAuthenticationProvider.typeFields"></div>
+ </fieldset>
</div>
- </div>
- <div class="dijitDialogPaneActionBar">
- <!-- submit buttons -->
- <input type="submit" value="Save Authentication Provider" label="Save Authentication Provider" dojoType="dijit.form.Button" />
- </div>
- </form>
+ </form>
+
+ <div id="addPreferencesProvider.form" xxx-data-dojo-type="qpid/management/preferencesprovider/PreferencesProviderForm"></div>
+ </div>
+ <div class="dijitDialogPaneActionBar">
+ <button data-dojo-type="dijit/form/Button" id="addAuthenticationProvider.addButton" data-dojo-props="label: 'Add'" type="submit"></button>
+ <button data-dojo-type="dijit/form/Button" id="addAuthenticationProvider.cancelButton" data-dojo-props="label: 'Cancel'" ></button>
+ </div>
</div>
</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html
index bca2320888..e850f5ac7f 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html
@@ -15,17 +15,14 @@
~ limitations under the License.
-->
<div class="dijitHidden">
- <div data-dojo-type="dijit.Dialog" data-dojo-props="title:'Preferences Provider'" id="addPreferencesProvider">
- <form id="formAddPreferencesProvider" method="post" data-dojo-type="dijit.form.Form">
- <input type="hidden" id="preferencesProvider.id" name="id"/>
- <div style="width:420px; overflow: auto">
- <div id="addPreferencesProvider.preferencesProvider"></div>
- </div>
- <div class="dijitDialogPaneActionBar">
- <!-- submit buttons -->
- <input type="submit" value="Save Preferences Provider" data-dojo-props="label: 'Save Preferences Provider'" data-dojo-type="dijit.form.Button" />
- <input type="button" value="Cancel" data-dojo-props="label: 'Cancel'" data-dojo-type="dijit.form.Button" id="addPreferencesProvider.cancelButton"/>
- </div>
- </form>
+ <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Preferences Provider'" id="addPreferencesProvider">
+
+ <div id="addPreferencesProvider.preferencesProvider" data-dojo-type="qpid/management/preferencesprovider/PreferencesProviderForm"></div>
+
+ <div class="dijitDialogPaneActionBar">
+ <!-- submit buttons -->
+ <input type="button" value="Save" data-dojo-props="label: 'Save'" data-dojo-type="dijit/form/Button" id="addPreferencesProvider.saveButton"/>
+ <input type="button" value="Cancel" data-dojo-props="label: 'Cancel'" data-dojo-type="dijit/form/Button" id="addPreferencesProvider.cancelButton"/>
+ </div>
</div>
</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html
new file mode 100644
index 0000000000..8c50252058
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html
@@ -0,0 +1,26 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Use full DN:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="useFullDN"
+ data-dojo-type="dijit/form/CheckBox"
+ data-dojo-props=" name: 'useFullDN' " />
+ </div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/passwordfile/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/passwordfile/add.html
new file mode 100644
index 0000000000..53eb786722
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/passwordfile/add.html
@@ -0,0 +1,31 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Path*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="path"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'path',
+ required: true,
+ placeHolder: 'path/to/store',
+ title: 'Enter path to user store',
+ promptMessage: 'File system location for the users store.'"/>
+ </div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html
deleted file mode 100644
index 48e9c19748..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<table class="tableContainer-table tableContainer-table-horiz" style="margin:0; width:100%" cellspacing="1">
- <tr>
- <td class="tableContainer-labelCell"><strong>Path*: </strong></td>
- <td class="tableContainer-valueCell" >
- <input type="text" name="preferencesProviderPath"
- id="preferencesProvider.path"
- data-dojo-type="dijit.form.ValidationTextBox"
- data-dojo-props="placeHolder: 'Path/to/file',
- required: true,
- missingMessage: 'A path must be supplied',
- title: 'Enter path'"/></td>
- </tr>
-</table>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html
new file mode 100644
index 0000000000..16463565e3
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html
@@ -0,0 +1,129 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">LDAP server URL*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="providerUrl"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'providerUrl',
+ required: true,
+ placeHolder: 'ldap://host:port',
+ title: 'Enter LDAP server URL',
+ promptMessage: 'LDAP server URL'"/>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Search context*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="searchContext"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'searchContext',
+ required: true,
+ placeHolder: 'dc=users,dc=example,dc=com',
+ title: 'Enter search context',
+ promptMessage: 'The distinguished name of the search base object'"/>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Search filter*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="searchFilter"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'searchFilter',
+ required: true,
+ placeHolder: '(uid={0})',
+ title: 'Enter user search filter ',
+ promptMessage: 'DN template to find an LDAP user entry by provided user name'"/>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Search username:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="searchUsername"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'searchUsername',
+ placeHolder: 'username',
+ title: 'Enter username for authenticated search',
+ promptMessage: 'Username for authenticated search'"/>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Search password:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="searchPassword"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'searchPassword',
+ placeHolder: '****',
+ title: 'Enter password for authenticated search',
+ promptMessage: 'Password for authenticated search'"/>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Trust Store:</div>
+ <div class="tableContainer-valueCell formLabel-controlCell">
+ <select class="trustStore" data-dojo-type="dijit/form/FilteringSelect"
+ data-dojo-props="
+ required: false,
+ name: 'trustStore',
+ placeHolder: 'Select trust store',
+ promptMessage: 'Trust store containing certificate for SSL transport',
+ title: 'Select trust store for secure connection',
+ searchAttr: 'name'">
+ </select>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Bind without search:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="bindWithoutSearch"
+ data-dojo-type="dijit/form/CheckBox"
+ data-dojo-props=" name: 'bindWithoutSearch' " />
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">LDAP Context Factory:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="ldapContextFactory"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'ldapContextFactory',
+ placeHolder: 'com.sun.jndi.ldap.LdapCtxFactory',
+ title: 'Enter fully qualified class name for LDAP Context Factory',
+ promptMessage: 'Fully qualified class name for LDAP Context Factory'"/>
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">LDAP authentication URL</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="providerAuthUrl"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'providerAuthUrl',
+ placeHolder: 'ldap://host:port',
+ title: 'Enter optional LDAP authentication URL',
+ promptMessage: 'URL of LDAP server for performing \'ldap bind\'. If not specified, the LDAP server URL will be used for both searches and authentications'"/>
+ </div>
+ </div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
index 901172f80e..749b9b89cb 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js
@@ -65,6 +65,10 @@ define(["dojo/_base/xhr",
}
}
return values;
+ },
+ implementsManagedInterface: function (category, type, managedInterfaceName)
+ {
+ return this.getMetaData(category, type).managedInterfaces.indexOf(managedInterfaceName) >= 0;
}
};
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
index 771d29601e..53340edc85 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js
@@ -152,8 +152,12 @@ define(["dojo/_base/xhr",
util.isProviderManagingUsers = function(type)
{
- return (type === "PlainPasswordFile" || type === "Base64MD5PasswordFile" || type === "SCRAM-SHA-1"
- || type === "SCRAM-SHA-256" || type === "Plain" || type === "MD5" );
+ return metadata.implementsManagedInterface("AuthenticationProvider", type, "PasswordCredentialManagingAuthenticationProvider");
+ };
+
+ util.supportsPreferencesProvider = function(type)
+ {
+ return metadata.implementsManagedInterface("AuthenticationProvider", type, "PreferencesSupportingAuthenticationProvider");
};
util.showSetAttributesDialog = function(attributeWidgetFactories, data, putURL, dialogTitle, category, type, appendNameToUrl)
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProviderFields.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProviderFields.js
deleted file mode 100644
index afd05aeda3..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProviderFields.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-define(["dojo/_base/xhr",
- "dojo/dom",
- "dojo/query",
- "dojo/parser",
- "dojo/string",
- "dojo/json",
- "dojo/store/Memory",
- "dijit/registry",
- "dijit/form/FilteringSelect",
- "dijit/form/ValidationTextBox",
- "dojox/html/entities",
- "dojo/text!../../showPreferencesProviderFields.html",
- "dojo/text!service/helper?action=ListPreferencesProvidersTypes",
- "qpid/common/util",
- "dojox/validate/us",
- "dojox/validate/web",
- "dojo/domReady!"], function (xhr, dom, query, parser, string, json, Memory, registry, FilteringSelect, ValidationTextBox, entities, template, preferencesProvidersTypes, util) {
-
- var PreferencesProviderFields = {};
-
- var types = [{id: "", name: "None"}];
- var typesArray = json.parse(preferencesProvidersTypes);
- for (var i =0 ; i < typesArray.length; i++)
- {
- types.push({id: typesArray[i], name: typesArray[i]});
- }
-
- var selectPreferencesProviderType = function(type)
- {
- if(type && string.trim(type) != "")
- {
- var disableOnEditing = PreferencesProviderFields.data? true: false;
- PreferencesProviderFields.name.set("disabled", disableOnEditing);
- PreferencesProviderFields.type.set("disabled", disableOnEditing);
- if (PreferencesProviderFields.currentType != type)
- {
- require(["qpid/management/authenticationprovider/preferences/" + type.toLowerCase() + "/add"],
- function(typeFields)
- {
- PreferencesProviderFields.currentType = null;
- if (PreferencesProviderFields.details )
- {
- PreferencesProviderFields.details.destroy();
- }
- PreferencesProviderFields.details = typeFields;
- typeFields.show(PreferencesProviderFields.fieldsContainer, PreferencesProviderFields.data);
- PreferencesProviderFields.currentType = type;
- });
- }
- else
- {
- PreferencesProviderFields.details.disable(false);
- }
- }
- else
- {
- PreferencesProviderFields.disable(true);
- }
- };
-
- PreferencesProviderFields.init = function(data)
- {
- this.data = data;
- this.id.value = data.id;
- this.name.set("value", data.name);
- this.type.set("value", data.type);
- selectPreferencesProviderType(data.type);
- };
-
- PreferencesProviderFields.show = function(node, provider, authenticationProviderName)
- {
- this.currentType = null;
- this.data = null;
- node.innerHTML = template;
- try
- {
- parser.parse(node);
- }
- catch(e)
- {
- console.error(e);
- return;
- }
-
- if (this.container)
- {
- this.container.destroyRecursive();
- }
- if (this.details )
- {
- this.details.destroy();
- delete this["details"];
- }
- this.container = registry.byNode(query(".preferencesProviderContainer", node)[0]);
- this.fieldsContainer = query(".preferencesProviderFieldsContainer", node)[0];
- this.type = registry.byNode(query(".preferencesProviderType", node)[0]);
- this.name = registry.byNode(query(".preferencesProviderName", node)[0]);
- this.name.set("regExpGen", util.nameOrContextVarRegexp);
- this.id = query("input[name='preferencesProviderId']", node)[0];
- this.id.value = null;
- this.type.set("store", new Memory({ data: types, idProperty: "id"}));
- this.type.on("change", selectPreferencesProviderType );
- this.type.startup();
-
- if (provider)
- {
- if (typeof provider == "object")
- {
- this.init(provider);
- }
- else if (typeof provider == "string")
- {
- var that = this;
- xhr.get({
- url: "api/latest/preferencesprovider/" +encodeURIComponent(authenticationProviderName) + "/" + encodeURIComponent(provider),
- sync: true,
- content: { actuals: true },
- handleAs: "json"
- }).then(function(data){if (data && data[0]) { that.init(data[0]);}});
- }
- }
- else
- {
- this.disable(true);
- }
- };
-
- PreferencesProviderFields.disable = function(val)
- {
- this.name.set("disabled", val);
- if (this.details)
- {
- this.details.disable(val);
- }
- };
-
- PreferencesProviderFields.getValues = function()
- {
- var values = {};
- if (this.details)
- {
- values = this.details.getValues() || {};
- }
- values.name = this.name.get("value");
- if (this.id.value)
- {
- values.id = this.id.value;
- }
- values.type = this.type.get("value");
- return values;
- };
-
- PreferencesProviderFields.save = function(authenticationProviderName)
- {
- var success = true;
- if (this.type.value)
- {
- var data = this.getValues();
- xhr.put({url: "api/latest/preferencesprovider/" +encodeURIComponent(authenticationProviderName) + "/" + encodeURIComponent(data.name),
- sync: true,
- handleAs: "json",
- headers: { "Content-Type": "application/json"},
- putData: json.stringify(data),
- load: function(x) {success = true;},
- error: function(error) {success = false; util.xhrErrorHandler(error);}});
- }
- return success;
- };
-
- return PreferencesProviderFields;
-
-}); \ No newline at end of file
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
index c59e86aaa1..51f2acb685 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
@@ -26,13 +26,15 @@ define(["dojo/_base/xhr",
"dojo/parser",
"dojo/_base/array",
"dojo/_base/event",
- 'dojo/_base/json',
+ 'dojo/json',
"dojo/store/Memory",
"dijit/form/FilteringSelect",
"dojo/_base/connect",
"dojo/dom-style",
- "qpid/management/PreferencesProviderFields",
"qpid/common/util",
+ "qpid/common/metadata",
+ "dojo/text!addAuthenticationProvider.html",
+ "qpid/management/preferencesprovider/PreferencesProviderForm",
/* dojox/ validate resources */
"dojox/validate/us", "dojox/validate/web",
/* basic dijit classes */
@@ -46,252 +48,136 @@ define(["dojo/_base/xhr",
"dojox/form/BusyButton", "dojox/form/CheckedMultiSelect",
"dojox/layout/TableContainer",
"dojo/domReady!"],
- function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, PreferencesProviderFields, util) {
-
- var addAuthenticationProvider = {};
-
- var node = construct.create("div", null, win.body(), "last");
-
- var convertToAuthenticationProvider = function convertToAuthenticationProvider(formValues)
+ function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, util, metadata, template)
+ {
+ var addAuthenticationProvider =
{
- var newProvider = {};
+ init:function()
+ {
+ var that=this;
+ this.containerNode = construct.create("div", {innerHTML: template});
+ parser.parse(this.containerNode);
+
+ var authenticationProviderName = registry.byId("addAuthenticationProvider.name");
+ authenticationProviderName.set("regExpGen", util.nameOrContextVarRegexp);
+
+ this.dialog = registry.byId("addAuthenticationProvider");
+ this.addButton = registry.byId("addAuthenticationProvider.addButton");
+ this.cancelButton = registry.byId("addAuthenticationProvider.cancelButton");
+ this.cancelButton.on("click", function(e){that._cancel(e);});
+ this.addButton.on("click", function(e){that._add(e);});
+
+ this.authenticationProviderTypeFieldsContainer = dom.byId("addAuthenticationProvider.typeFields");
+ this.authenticationProviderForm = registry.byId("addAuthenticationProvider.form");
+ this.authenticationProviderType = registry.byId("addAuthenticationProvider.type");
+ this.supportedAuthenticationProviderTypes = metadata.getTypesForCategory("AuthenticationProvider");
+ this.supportedAuthenticationProviderTypes.sort();
+ var authenticationProviderTypeStore = util.makeTypeStore(this.supportedAuthenticationProviderTypes);
+ this.authenticationProviderType.set("store", authenticationProviderTypeStore);
+ this.authenticationProviderType.on("change", function(type){that._authenticationProviderTypeChanged(type);});
+
+ this.preferencesProviderForm = new qpid.preferencesprovider.PreferencesProviderForm({disabled: true});
+ this.preferencesProviderForm.placeAt(dom.byId("addPreferencesProvider.form"));
+ },
+ show:function(providerName)
+ {
+ this.authenticationProviderForm.reset();
+ this.preferencesProviderForm.reset();
- newProvider.name = dijit.byId("formAddAuthenticationProvider.name").value;
- newProvider.type = dijit.byId("authenticationProviderType").value;
- var id = dojo.byId("formAddAuthenticationProvider.id").value;
- if (id)
+ this.dialog.show();
+ if (!this.resizeEventRegistered)
+ {
+ this.resizeEventRegistered = true;
+ util.resizeContentAreaAndRepositionDialog(dom.byId("addAuthenticationProvider.contentPane"), this.dialog);
+ }
+ },
+ _cancel: function(e)
{
- newProvider.id = id;
- }
- for(var propName in formValues)
+ event.stop(e);
+ this.dialog.hide();
+ },
+ _add: function(e)
+ {
+ event.stop(e);
+ this._submit();
+ },
+ _submit: function()
{
- if(formValues.hasOwnProperty(propName))
+ if(this.authenticationProviderForm.validate() && this.preferencesProviderForm.validate())
{
- if (propName.indexOf("preferencesProvider") == 0)
+ var success = false,failureReason=null;
+
+ var authenticationProviderData = util.getFormWidgetValues(this.authenticationProviderForm); // TODO initialValues
+
+ var encodedAuthenticationProviderName = encodeURIComponent(authenticationProviderData.name);
+ xhr.put({
+ url: "api/latest/authenticationprovider/" + encodedAuthenticationProviderName,
+ sync: true,
+ handleAs: "json",
+ headers: { "Content-Type": "application/json"},
+ putData: json.stringify(authenticationProviderData),
+ load: function(x) {success = true; },
+ error: function(error) {success = false; failureReason = error;}
+ });
+
+ if(success === true)
{
- continue;
- }
- if(formValues[ propName ] !== "") {
- newProvider[ propName ] = formValues[propName];
+ var preferencesProviderResult = this.preferencesProviderForm.submit(encodedAuthenticationProviderName);
+ success = preferencesProviderResult.success;
+ failureReason = preferencesProviderResult.failureReason;
}
+ if (success == true)
+ {
+ this.dialog.hide();
+ }
+ else
+ {
+ util.xhrErrorHandler(failureReason);
+ }
}
- }
- return newProvider;
- }
-
- var showFieldSets = function showFieldSets(providerType, fieldSets)
- {
- for(var key in fieldSets)
- {
- var layout = fieldSets[key];
- var disabled = key != providerType;
- var displayValue = key == providerType ? "block" : "none";
- var widgets = layout.getDescendants();
- array.forEach(widgets, function(widget)
+ else
{
- widget.set("disabled", disabled);
- });
-
- domStyle.set(fieldSets[key].domNode, "display", displayValue);
- }
- if (fieldSets[providerType])
+ alert('Form contains invalid data. Please correct first');
+ }
+ },
+ _authenticationProviderTypeChanged: function(type)
+ {
+ this._typeChanged(type, this.authenticationProviderTypeFieldsContainer, "qpid/management/authenticationprovider/", "AuthenticationProvider" );
+ },
+ _typeChanged: function(type, typeFieldsContainer, baseUrl, category )
{
- fieldSets[providerType].getParent().resize();
+ var widgets = registry.findWidgets(typeFieldsContainer);
+ array.forEach(widgets, function(item) { item.destroyRecursive();});
+ this.preferencesProviderForm.set("disabled", !type || !util.supportsPreferencesProvider(type));
+ if (type)
+ {
+ var that = this;
+ require([ baseUrl + type.toLowerCase() + "/add"], function(typeUI)
+ {
+ try
+ {
+ typeUI.show({containerNode:typeFieldsContainer, parent: that});
+ util.applyMetadataToWidgets(typeFieldsContainer, category, type);
+ }
+ catch(e)
+ {
+ console.warn(e);
+ }
+ });
+ }
}
- }
-
- var getAuthenticationProviderWidgetId = function getAuthenticationProviderWidgetId(providerType, attribute)
- {
- return "ap_" + providerType + "Field" + attribute;
- }
+ };
- var showPreferencesProviderFields = function showPreferencesProviderFields(provider)
+ try
{
- var preferencesProviderDiv = dojo.byId("addAuthenticationProvider.preferencesProvider");
- var preferencesProviderPanel = dijit.byId("addAuthenticationProvider.preferencesProviderPanel");
- if (provider && provider.type == "Anonymous")
- {
- preferencesProviderPanel.domNode.style.display = 'none';
- }
- else
- {
- preferencesProviderPanel.domNode.style.display = 'block';
- PreferencesProviderFields.show(preferencesProviderDiv, provider && provider.preferencesproviders ? provider.preferencesproviders[0] : null);
- }
+ addAuthenticationProvider.init();
}
-
- var loadProviderAndDisplayForm = function loadProviderAndDisplayForm(providerName, dialog)
+ catch(e)
{
- if (providerName)
- {
- xhr.get({
- url: "api/latest/authenticationprovider/" + encodeURIComponent(providerName),
- content: { actuals: true },
- handleAs: "json"
- }).then(
- function(data) {
- var provider = data[0];
- var providerType = provider.type;
- var nameField = dijit.byId("formAddAuthenticationProvider.name");
- nameField.set("value", provider.name);
- nameField.set("disabled", true);
- nameField.set("regExpGen", util.nameOrContextVarRegexp);
- dialog.providerChooser.set("value", providerType);
- dialog.providerChooser.set("disabled", true);
- dojo.byId("formAddAuthenticationProvider.id").value=provider.id;
- for(var attribute in provider)
- {
- if (provider.hasOwnProperty(attribute))
- {
- var widject = dijit.byId(getAuthenticationProviderWidgetId(providerType, attribute));
- if (widject)
- {
- widject.set("value", provider[attribute]);
- }
- }
- }
- showPreferencesProviderFields(provider);
- registry.byId("addAuthenticationProvider").show();
- });
- }
- else
- {
- showPreferencesProviderFields();
- registry.byId("addAuthenticationProvider").show();
- }
- }
-
- xhr.get({url: "addAuthenticationProvider.html",
- sync: true,
- load: function(data) {
- var theForm;
- node.innerHTML = data;
- addAuthenticationProvider.dialogNode = dom.byId("addAuthenticationProvider");
- parser.instantiate([addAuthenticationProvider.dialogNode]);
- theForm = registry.byId("formAddAuthenticationProvider");
- theForm.on("submit", function(e) {
-
- event.stop(e);
- if(theForm.validate()){
-
- var newAuthenticationManager = convertToAuthenticationProvider(theForm.getValues());
- var that = this;
-
- xhr.put({url: "api/latest/authenticationprovider/" + encodeURIComponent(newAuthenticationManager.name),
- sync: true, handleAs: "json",
- headers: { "Content-Type": "application/json"},
- putData: json.toJson(newAuthenticationManager),
- load: function(x) {that.success = true; },
- error: function(error) {that.success = false; that.failureReason = error;}});
-
- if(this.success === true)
- {
- if (PreferencesProviderFields.save(newAuthenticationManager.name))
- {
- registry.byId("addAuthenticationProvider").hide();
- }
- }
- else
- {
- util.xhrErrorHandler(this.failureReason);
- }
- return false;
- }else{
- alert('Form contains invalid data. Please correct first');
- return false;
- }
- });
- }});
-
- addAuthenticationProvider.show = function(providerName) {
- var that = this;
- registry.byId("formAddAuthenticationProvider").reset();
- dojo.byId("formAddAuthenticationProvider.id").value="";
- registry.byId("formAddAuthenticationProvider.name").set("disabled", false);
- if (this.providerChooser)
- {
- this.providerChooser.set("disabled", false);
- }
-
- if (!that.hasOwnProperty("providerFieldSets"))
- {
- xhr.get({
- url: "service/helper?action=ListAuthenticationProviderAttributes",
- handleAs: "json"
- }).then(
- function(data) {
- var providers = [];
- var providerIndex = 0;
- that.providerFieldSetsContainer = dom.byId("addAuthenticationProvider.fieldSets");
- that.providerFieldSets = [];
-
- for (var providerType in data) {
- if (data.hasOwnProperty(providerType)) {
- providers[providerIndex++] = {id: providerType, name: providerType};
-
- var attributes = data[providerType].attributes;
- var resources = data[providerType].descriptions;
- var layout = new dojox.layout.TableContainer( {
- id: providerType + "FieldSet",
- cols: 1,
- "labelWidth": "200",
- showLabels: true,
- orientation: "horiz"
- });
- for(var i=0; i < attributes.length; i++) {
- if ("type" == attributes[i])
- {
- continue;
- }
- var labelValue = attributes[i];
- if (resources && resources[attributes[i]])
- {
- labelValue = resources[attributes[i]];
- }
- var text = new dijit.form.TextBox({
- label: labelValue + ":",
- id: getAuthenticationProviderWidgetId(providerType, attributes[i]),
- name: attributes[i]
- });
- layout.addChild(text);
- }
- layout.placeAt("addAuthenticationProvider.fieldSets");
- that.providerFieldSets[providerType]=layout;
- layout.startup();
- }
- }
-
- var providersStore = new Memory({ data: providers });
- if(that.providerChooser) {
- that.providerChooser.destroy( false );
- }
-
- var providersDiv = dom.byId("addAuthenticationProvider.selectAuthenticationProviderDiv");
- var input = construct.create("input", {id: "addAuthenticationProviderType"}, providersDiv);
-
- that.providerChooser = new FilteringSelect({ id: "authenticationProviderType",
- name: "type",
- store: providersStore,
- searchAttr: "name"}, input);
- that.providerChooser.on("change",
- function(value)
- {
- dijit.byId("addAuthenticationProvider.preferencesProviderPanel").domNode.style.display = (value == "Anonymous" ? "none" : "block");
- showFieldSets(that.providerChooser.value, that.providerFieldSets);
- }
- );
- var providerType = providers[0].name;
- that.providerChooser.set("value", providerType);
- showFieldSets(providerType, that.providerFieldSets);
- loadProviderAndDisplayForm(providerName, that)
- });
- }
- else
- {
- loadProviderAndDisplayForm(providerName, that);
- }
+ console.warn(e);
}
-
return addAuthenticationProvider;
- }); \ No newline at end of file
+ }
+
+);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js
index 40f8f83fbb..072b202b23 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js
@@ -18,77 +18,74 @@
* under the License.
*
*/
-define(["dojo/_base/xhr",
- "dojo/dom",
+define([
+ "dojo/_base/event",
"dojo/dom-construct",
- "dojo/query",
- "dojo/_base/window",
- "dijit/registry",
"dojo/parser",
- "dojo/_base/array",
- "dojo/_base/event",
- 'dojo/_base/json',
- "dojo/store/Memory",
- "dijit/form/FilteringSelect",
- "dojo/_base/connect",
- "dojo/dom-style",
- "dojo/string",
+ "dijit/registry",
+ "qpid/management/preferencesprovider/PreferencesProviderForm",
+ "qpid/common/util",
+ "dojo/text!addPreferencesProvider.html",
"dojox/html/entities",
- "qpid/management/PreferencesProviderFields",
"dojox/validate/us",
"dojox/validate/web",
"dijit/Dialog",
- "dijit/form/CheckBox",
- "dijit/form/Textarea",
- "dijit/form/TextBox",
- "dijit/form/ValidationTextBox",
"dijit/form/Button",
- "dijit/form/Form",
- "dojox/form/BusyButton",
- "dojox/form/CheckedMultiSelect",
- "dojox/layout/TableContainer",
"dojo/domReady!"],
- function (xhr, dom, construct, query, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, string, entities, PreferencesProviderFields) {
-
- var addPreferencesProvider = {};
+ function ( event, construct, parser, registry, PreferencesProviderForm, util, template, entities) {
- var node = construct.create("div", null, win.body(), "last");
+ var addPreferencesProvider =
+ {
+ init: function()
+ {
+ var that=this;
+ this.containerNode = construct.create("div", {innerHTML: template});
+ parser.parse(this.containerNode);
- xhr.get({url: "addPreferencesProvider.html",
- sync: true,
- load: function(data) {
- node.innerHTML = data;
- addPreferencesProvider.dialogNode = dom.byId("addPreferencesProvider");
- parser.instantiate([addPreferencesProvider.dialogNode]);
+ this.preferencesProviderForm = registry.byId("addPreferencesProvider.preferencesProvider");
+ this.dialog = registry.byId("addPreferencesProvider");
- var cancelButton = registry.byId("addPreferencesProvider.cancelButton");
- cancelButton.on("click", function(){
- registry.byId("addPreferencesProvider").hide();
- });
- var theForm = registry.byId("formAddPreferencesProvider");
- theForm.on("submit", function(e) {
+ var cancelButton = registry.byId("addPreferencesProvider.cancelButton");
+ cancelButton.on("click", function() { that.dialog.hide(); });
- event.stop(e);
- if(theForm.validate()){
- if(PreferencesProviderFields.save(addPreferencesProvider.authenticationProviderName))
- {
- registry.byId("addPreferencesProvider").hide();
- }
- return false;
- }else{
- alert('Form contains invalid data. Please correct first');
- return false;
- }
- });
- }});
+ var saveButton = registry.byId("addPreferencesProvider.saveButton");
+ saveButton.on("click", function()
+ {
+ var result = that.preferencesProviderForm.submit(encodeURIComponent(addPreferencesProvider.authenticationProviderName));
+ if (result.success)
+ {
+ that.dialog.hide();
+ }
+ else
+ {
+ util.xhrErrorHandler(result.failureReason);
+ }
+ });
+ },
+ show: function(authenticationProviderName, providerName)
+ {
+ this.authenticationProviderName = authenticationProviderName;
+ this.dialog.set("title", (providerName ? "Edit preferences provider '" + entities.encode(String(providerName)) + "' " : "Add preferences provider ") + " for '" + entities.encode(String(authenticationProviderName)) + "' ");
+ if (providerName)
+ {
+ this.preferencesProviderForm.load(authenticationProviderName, providerName);
+ }
+ else
+ {
+ this.preferencesProviderForm.reset();
+ }
+ this.dialog.show();
+ }
+ };
- addPreferencesProvider.show = function(authenticationProviderName, providerName) {
- this.authenticationProviderName = authenticationProviderName;
- PreferencesProviderFields.show(dom.byId("addPreferencesProvider.preferencesProvider"), providerName, authenticationProviderName)
- var dialog = registry.byId("addPreferencesProvider");
- dialog.set("title", (providerName ? "Edit preferences provider '" + entities.encode(String(providerName)) + "' " : "Add preferences provider ") + " for '" + entities.encode(String(authenticationProviderName)) + "' ")
- dialog.show();
+ try
+ {
+ addPreferencesProvider.init();
+ }
+ catch(e)
+ {
+ console.warn("Initialisation of add preferences dialog failed", e);
}
return addPreferencesProvider;
- }); \ No newline at end of file
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js
new file mode 100644
index 0000000000..73022a0855
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js
@@ -0,0 +1,21 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([], function () { return { show: function(data){} }; });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js
new file mode 100644
index 0000000000..b1beadb489
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/query","dijit/registry","qpid/common/util"],
+ function (query, registry, util)
+ {
+ return {
+ show: function(data)
+ {
+ util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/passwordfile/add.html");
+ if (data.data)
+ {
+ var path = registry.byNode(query(".path", data.containerNode)[0]);
+ path.set("value", data.data.useFullDN);
+ }
+ }
+ };
+ }
+);
+
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js
new file mode 100644
index 0000000000..6147bf5249
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/query","dijit/registry","qpid/common/util"],
+ function (query, registry, util)
+ {
+ return {
+ show: function(data)
+ {
+ util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/external/add.html");
+ if (data.data)
+ {
+ var useFullDN = registry.byNode(query(".useFullDN", data.containerNode)[0]);
+ useFullDN.set("value", data.data.useFullDN);
+ }
+ }
+ };
+ }
+);
+
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js
new file mode 100644
index 0000000000..f76c75f05e
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js
@@ -0,0 +1,22 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([], function () { return { show: function(data){} }; });
+
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js
new file mode 100644
index 0000000000..73022a0855
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js
@@ -0,0 +1,21 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([], function () { return { show: function(data){} }; });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js
new file mode 100644
index 0000000000..73022a0855
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js
@@ -0,0 +1,21 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([], function () { return { show: function(data){} }; });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js
new file mode 100644
index 0000000000..b1beadb489
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/query","dijit/registry","qpid/common/util"],
+ function (query, registry, util)
+ {
+ return {
+ show: function(data)
+ {
+ util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/passwordfile/add.html");
+ if (data.data)
+ {
+ var path = registry.byNode(query(".path", data.containerNode)[0]);
+ path.set("value", data.data.useFullDN);
+ }
+ }
+ };
+ }
+);
+
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js
deleted file mode 100644
index 06dd9dd0e3..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-define(["dojo/_base/xhr",
- "dojo/dom",
- "dojo/dom-construct",
- "dojo/_base/window",
- "dijit/registry",
- "dojo/parser",
- "dojo/_base/array",
- "dojo/_base/event",
- "dojo/_base/json",
- "dojo/string",
- "dojox/html/entities",
- "dojo/text!../../../../../authenticationprovider/preferences/filesystempreferences/add.html",
- "dojo/domReady!"],
- function (xhr, dom, domConstruct, win, registry, parser, array, event, json, string, entities, template) {
- return {
- show: function(node, data)
- {
- this.destroy();
- this.node = node;
- node.innerHTML = template;
- parser.parse(node);
- var pathWidget = registry.byId("preferencesProvider.path")
- if (data)
- {
- pathWidget.set("value", entities.encode(String(data["path"])));
- }
- },
- destroy: function()
- {
- if (this.node)
- {
- dojo.forEach(dijit.findWidgets(this.node), function(w) {w.destroyRecursive();});
- this.node = null;
- }
- },
- disable: function(val)
- {
- var pathWidget = registry.byId("preferencesProvider.path");
- pathWidget.set("disabled", val);
- },
- getValues: function()
- {
- return {path: registry.byId("preferencesProvider.path").value};
- }
- };
- });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js
new file mode 100644
index 0000000000..73022a0855
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js
@@ -0,0 +1,21 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([], function () { return { show: function(data){} }; });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js
new file mode 100644
index 0000000000..73022a0855
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js
@@ -0,0 +1,21 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([], function () { return { show: function(data){} }; });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js
new file mode 100644
index 0000000000..1334ea14fa
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js
@@ -0,0 +1,77 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/_base/xhr","dojo/query","dijit/registry","qpid/common/util","qpid/common/metadata","dojo/store/Memory","dijit/form/FilteringSelect","dijit/form/ValidationTextBox","dijit/form/CheckBox"],
+ function (xhr, query, registry, util, metadata, Memory)
+ {
+ return {
+ show: function(data)
+ {
+ util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/simpleldap/add.html");
+
+ var that = this;
+ xhr.get({url: "api/latest/truststore", sync: true, handleAs: "json"}).then(
+ function(data)
+ {
+ that._initTrustStores(data,data.containerNode);
+ }
+ );
+
+ if (data.data)
+ {
+ this._initFields(data.data);
+ }
+ },
+ _initTrustStores: function(trustStores, containerNode)
+ {
+ var data = [];
+ for (var i=0; i< trustStores.length; i++)
+ {
+ data.push( {id: trustStores[i].name, name: trustStores[i].name} );
+ }
+ var trustStoresStore = new Memory({ data: data });
+
+ var trustStore = registry.byNode(query(".trustStore", data.containerNode)[0]);
+ trustStore.set("store", trustStoresStore);
+ },
+ _initFields:function(data)
+ {
+ var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes;
+ for(var name in attributes)
+ {
+ var widget = registry.byNode(query("." + name, data.containerNode)[0]);
+ if (widget)
+ {
+ if (widget instanceof dijit.form.CheckBox)
+ {
+ widget.set("checked", data[name]);
+ }
+ else
+ {
+ widget.set("value", data[name]);
+ }
+ }
+ }
+ var bindWithoutSearch =
+ bindWithoutSearch.set("checked", data.data.bindWithoutSearch);
+ }
+ };
+ }
+);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js
new file mode 100644
index 0000000000..acb09b5fd8
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js
@@ -0,0 +1,190 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define([
+ "qpid/common/util",
+ "qpid/common/metadata",
+ "dojo/_base/xhr",
+ "dojo/_base/declare",
+ "dojo/_base/array",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dojo/query",
+ "dojo/json",
+ "dijit/_WidgetBase",
+ "dijit/_OnDijitClickMixin",
+ "dijit/_TemplatedMixin",
+ "dijit/_WidgetsInTemplateMixin",
+ "dijit/registry",
+ "dojo/text!preferencesprovider/preferencesProviderForm.html",
+ "dojox/html/entities",
+ "dijit/form/ValidationTextBox",
+ "dijit/form/FilteringSelect",
+ "dojox/validate/us",
+ "dojox/validate/web",
+ "dojo/domReady!"],
+function (util, metadata, xhr, declare, array, domConstruct, win, query, json, _WidgetBase,
+ _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin, registry, template, entities)
+ {
+
+ return declare("qpid.preferencesprovider.PreferencesProviderForm",
+ [_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin], {
+
+ templateString: template,
+ domNode: null,
+ preferencesProviderForm : null,
+ preferencesProviderNameWidget : null,
+ preferencesProviderTypeWidget : null,
+ preferencesProviderTypeFieldsContainer: null,
+
+ buildRendering: function()
+ {
+ //Strip out the apache comment header from the template html as comments unsupported.
+ this.templateString = this.templateString.replace(/<!--[\s\S]*?-->/g, "");
+ this.inherited(arguments);
+ },
+ postCreate: function()
+ {
+ this.inherited(arguments);
+ var that = this;
+
+ this.preferencesProviderNameWidget.set("regExpGen", util.nameOrContextVarRegexp);
+
+ var supportedPreferencesProviderTypes = metadata.getTypesForCategory("PreferencesProvider");
+ supportedPreferencesProviderTypes.sort();
+ supportedPreferencesProviderTypes.splice(0,0,"None");
+ var preferencesProviderTypeStore = util.makeTypeStore(supportedPreferencesProviderTypes);
+ this.preferencesProviderTypeWidget.set("store", preferencesProviderTypeStore);
+ this.preferencesProviderTypeWidget.on("change", function(type){that._preferencesProviderTypeChanged(type);});
+ this.preferencesProviderForm.on("submit", function() { return false; })
+ },
+ reset: function()
+ {
+ this.data = null;
+ this.preferencesProviderForm.reset();
+ this.preferencesProviderTypeWidget.set("value", "None");
+ },
+ submit: function(encodedAuthenticationProviderName)
+ {
+ if (this.preferencesProviderTypeWidget.get("value") != "None")
+ {
+ var preferencesProviderData = util.getFormWidgetValues(this.preferencesProviderForm); // TODO initialValues
+ var encodedPreferencesProviderName = encodeURIComponent(preferencesProviderData.name);
+ var success = false;
+ var failureReason = null;
+ xhr.put({
+ url: "api/latest/preferencesprovider/" + encodedAuthenticationProviderName + "/" + encodedPreferencesProviderName,
+ sync: true,
+ handleAs: "json",
+ headers: { "Content-Type": "application/json"},
+ putData: json.stringify(preferencesProviderData),
+ load: function (x) { success = true; },
+ error: function (error) { success = false; failureReason = error; }
+ });
+ return { success: success, failureReason: failureReason };
+ }
+ return { success: true, failureReason: null };
+ },
+ validate: function()
+ {
+ return this.preferencesProviderForm.validate();
+ },
+ load: function(authenticationProviderName, providerName)
+ {
+ var that = this;
+ xhr.get({
+ url: "api/latest/preferencesprovider/" + encodeURIComponent(authenticationProviderName) + "/" + encodeURIComponent(providerName),
+ handleAs: "json"
+ }).then(function(data){that._load(data[0])});
+ },
+ _load:function(data)
+ {
+ this.data = data;
+ this.preferencesProviderNameWidget.set("value", data.name);
+ if (data.type == this.preferencesProviderTypeWidget.get("value"))
+ {
+ this._toggleWidgets(data.type);
+ }
+ else
+ {
+ this.preferencesProviderTypeWidget.set("value", data.type);
+ }
+ },
+ _preferencesProviderTypeChanged: function(type)
+ {
+ var typeFieldsContainer = this.preferencesProviderTypeFieldsContainer;
+ var widgets = registry.findWidgets(typeFieldsContainer);
+ array.forEach(widgets, function(item) { item.destroyRecursive();});
+ domConstruct.empty(typeFieldsContainer);
+ this._toggleWidgets(type);
+ if (type)
+ {
+ if (type == "None")
+ {
+ this.preferencesProviderNameWidget.set("value", "");
+ }
+ else
+ {
+ var that = this;
+ require([ "qpid/management/preferencesprovider/" + type.toLowerCase() + "/add"], function(typeUI)
+ {
+ try
+ {
+ typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.data});
+ util.applyMetadataToWidgets(typeFieldsContainer, "PreferencesProvider", type);
+ }
+ catch(e)
+ {
+ console.warn(e);
+ }
+ });
+ }
+ }
+ },
+ _toggleWidgets: function(type)
+ {
+ if (this.disabled)
+ {
+ this.preferencesProviderNameWidget.set("disabled", true);
+ this.preferencesProviderTypeWidget.set("disabled", true);
+ }
+ else
+ {
+ if (this.data)
+ {
+ // editing
+ this.preferencesProviderNameWidget.set("disabled", true);
+ this.preferencesProviderTypeWidget.set("disabled", true);
+ }
+ else
+ {
+ this.preferencesProviderNameWidget.set("disabled", !type || type == "None");
+ this.preferencesProviderTypeWidget.set("disabled", false);
+ }
+ }
+ },
+ _setDisabledAttr: function(disabled)
+ {
+ this.inherited(arguments);
+ this.disabled = disabled;
+ this.reset();
+ },
+ });
+});
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js
new file mode 100644
index 0000000000..d030ea2832
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+define(["dojo/query", "dijit/registry", "qpid/common/util"],
+ function (query, registry, util)
+ {
+ return {
+ show: function (data)
+ {
+ util.parseHtmlIntoDiv(data.containerNode, "preferencesprovider/filesystempreferences/add.html");
+ if (data.data)
+ {
+ var pathWidget = registry.byNode(query(".addPreferencesProviderPath", data.containerNode)[0]);
+ pathWidget.set("value", data.data.path);
+ }
+ }
+ };
+ }
+);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html
new file mode 100644
index 0000000000..5990b43b98
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html
@@ -0,0 +1,37 @@
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+ -->
+<div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Path*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" class="addPreferencesProviderPath"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'path',
+ required: true,
+ placeHolder: 'path/to/store',
+ title: 'Enter preferences store path',
+ promptMessage: 'File system location for the preferences store.'"/>
+ </div>
+ </div>
+
+ <div class="clear"></div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html
new file mode 100644
index 0000000000..979b3abe8d
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html
@@ -0,0 +1,62 @@
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+ -->
+<div>
+<form class="addPreferencesProviderForm" method="post" data-dojo-type="dijit/form/Form" data-dojo-attach-point="preferencesProviderForm">
+ <div class="formBox">
+ <fieldset>
+ <legend>Preferences Provider</legend>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text"
+ data-dojo-attach-point="preferencesProviderNameWidget"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'name',
+ required: true,
+ disabled: true,
+ placeHolder: 'preferences provider name',
+ promptMessage: 'Name of preferences provider, must be unique',
+ title: 'Enter a unique preferences provider name per broker'" />
+ </div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div>
+ <div class="tableContainer-valueCell formLabel-controlCell">
+ <select data-dojo-attach-point="preferencesProviderTypeWidget"
+ data-dojo-type="dijit/form/FilteringSelect"
+ data-dojo-props="
+ name: 'type',
+ required: true,
+ disabled: true,
+ placeHolder: 'select preferences provider type',
+ promptMessage: 'Type of preferences provider',
+ title: 'Select preferences provider type',
+ searchAttr: 'name'">
+ </select>
+ </div>
+ </div>
+ <div class="clear"></div>
+ <div data-dojo-attach-point="preferencesProviderTypeFieldsContainer"></div>
+ </fieldset>
+ </div>
+</form>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProviderFields.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProviderFields.html
deleted file mode 100644
index f15a3a71b8..0000000000
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProviderFields.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!--
- -
- - Licensed to the Apache Software Foundation (ASF) under one
- - or more contributor license agreements. See the NOTICE file
- - distributed with this work for additional information
- - regarding copyright ownership. The ASF licenses this file
- - to you under the Apache License, Version 2.0 (the
- - "License"); you may not use this file except in compliance
- - with the License. You may obtain a copy of the License at
- -
- - http://www.apache.org/licenses/LICENSE-2.0
- -
- - Unless required by applicable law or agreed to in writing,
- - software distributed under the License is distributed on an
- - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- - KIND, either express or implied. See the License for the
- - specific language governing permissions and limitations
- - under the License.
- -
- -->
-<div data-dojo-type="dijit/layout/ContentPane" class="preferencesProviderContainer">
- <table class="tableContainer-table tableContainer-table-horiz" width="100%" cellspacing="1">
- <tr>
- <td class="tableContainer-labelCell"><strong>Type*:</strong></td>
- <td class="tableContainer-valueCell">
- <select class="preferencesProviderType" data-dojo-type="dijit/form/FilteringSelect"
- data-dojo-props="name:'preferencesProviderType',label:'Type:', searchAttr: 'name', placeHolder: 'Select Provider Type', required: true">
- <option value="">None</option>
- </select>
- </td>
- </tr>
- <tr>
- <td class="tableContainer-labelCell"><strong>Name*:</strong></td>
- <td class="tableContainer-valueCell"><input type="text" name="preferencesProviderName"
- class="preferencesProviderName" data-dojo-type="dijit/form/ValidationTextBox"
- data-dojo-props="placeHolder: 'Name', required: true, missingMessage: 'A name must be supplied', title: 'Enter name'" /></td>
- </tr>
- </table>
- <div class="preferencesProviderFieldsContainer"></div>
- <input type="hidden" name="preferencesProviderId"/>
-</div>