You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2015/06/22 20:07:19 UTC
svn commit: r1686908 - in /qpid/java/trunk:
broker-core/src/main/java/org/apache/qpid/server/security/
broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/
broker-plugins/management-http/src/main/java/...
Author: rgodfrey
Date: Mon Jun 22 18:07:19 2015
New Revision: 1686908
URL: http://svn.apache.org/r1686908
Log:
QPID-6605 : [Java Broker] Add new TrustStore type which trusts the certificate from a given URL
Added:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStore.java
- copied, changed from r1686817, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStore.java
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStoreImpl.java
- copied, changed from r1686817, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStoreImpl.java
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/add.js (with props)
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/show.js (with props)
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/add.html (with props)
qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/show.html (with props)
Modified:
qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/util/Functions.java
Copied: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStore.java (from r1686817, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStore.java)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStore.java?p2=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStore.java&p1=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStore.java&r1=1686817&r2=1686908&rev=1686908&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStore.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStore.java Mon Jun 22 18:07:19 2015
@@ -20,33 +20,45 @@
*/
package org.apache.qpid.server.security;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.qpid.server.model.DerivedAttribute;
import org.apache.qpid.server.model.ManagedAttribute;
import org.apache.qpid.server.model.ManagedObject;
+import org.apache.qpid.server.model.ManagedOperation;
import org.apache.qpid.server.model.TrustStore;
-@ManagedObject( category = false, type = "NonJavaTrustStore" )
-public interface NonJavaTrustStore<X extends NonJavaTrustStore<X>> extends TrustStore<X>
+@ManagedObject( category = false, type = "SiteSpecificTrustStore" )
+public interface SiteSpecificTrustStore<X extends SiteSpecificTrustStore<X>> extends TrustStore<X>
{
- @ManagedAttribute(defaultValue = "${this:certificateDetails}")
- String getDescription();
+ String CERTIFICATE = "certificate";
- @ManagedAttribute( mandatory = true, oversize = true, oversizedAltText = OVER_SIZED_ATTRIBUTE_ALTERNATIVE_TEXT )
- String getCertificatesUrl();
+ @ManagedAttribute(immutable = true)
+ String getSiteUrl();
- enum CertificateDetails
- {
- SUBJECT_NAME,
- ISSUER_NAME,
- VALID_START,
- VALID_END
+ @DerivedAttribute(persist = true)
+ String getCertificate();
- }
+ @DerivedAttribute
+ String getCertificateIssuer();
+
+ @DerivedAttribute
+ String getCertificateSubject();
+
+ @DerivedAttribute
+ String getCertificateSerialNumber();
+
+ @DerivedAttribute
+ String getCertificateSignature();
+
+ @DerivedAttribute
+ String getCertificateValidFromDate();
@DerivedAttribute
- List<Map<CertificateDetails,Object>> getCertificateDetails();
+ String getCertificateValidUntilDate();
+ @ManagedOperation
+ void refreshCertificate();
}
Copied: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStoreImpl.java (from r1686817, qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStoreImpl.java)
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStoreImpl.java?p2=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStoreImpl.java&p1=qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStoreImpl.java&r1=1686817&r2=1686908&rev=1686908&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/NonJavaTrustStoreImpl.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/security/SiteSpecificTrustStoreImpl.java Mon Jun 22 18:07:19 2015
@@ -20,26 +20,29 @@
*/
package org.apache.qpid.server.security;
-import java.io.File;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.net.MalformedURLException;
import java.net.URL;
import java.security.GeneralSecurityException;
import java.security.cert.Certificate;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.EnumMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
+import java.util.TimeZone;
-import javax.naming.InvalidNameException;
-import javax.naming.ldap.LdapName;
-import javax.naming.ldap.Rdn;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
-import javax.security.auth.x500.X500Principal;
+import javax.net.ssl.X509TrustManager;
+import javax.xml.bind.DatatypeConverter;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@@ -50,7 +53,6 @@ import org.apache.qpid.server.configurat
import org.apache.qpid.server.model.AbstractConfiguredObject;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Broker;
-import org.apache.qpid.server.model.ConfiguredObject;
import org.apache.qpid.server.model.IntegrityViolationException;
import org.apache.qpid.server.model.ManagedAttributeField;
import org.apache.qpid.server.model.ManagedObject;
@@ -61,19 +63,18 @@ import org.apache.qpid.server.model.Stat
import org.apache.qpid.server.model.TrustStore;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.security.auth.manager.SimpleLDAPAuthenticationManager;
-import org.apache.qpid.server.util.urlstreamhandler.data.Handler;
-import org.apache.qpid.transport.network.security.ssl.SSLUtil;
+import org.apache.qpid.transport.util.Functions;
@ManagedObject( category = false )
-public class NonJavaTrustStoreImpl
- extends AbstractConfiguredObject<NonJavaTrustStoreImpl> implements NonJavaTrustStore<NonJavaTrustStoreImpl>
+public class SiteSpecificTrustStoreImpl
+ extends AbstractConfiguredObject<SiteSpecificTrustStoreImpl> implements SiteSpecificTrustStore<SiteSpecificTrustStoreImpl>
{
- private static final Logger LOGGER = LoggerFactory.getLogger(NonJavaTrustStoreImpl.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(SiteSpecificTrustStoreImpl.class);
private final Broker<?> _broker;
- @ManagedAttributeField( afterSet = "updateTrustManagers" )
- private String _certificatesUrl;
+ @ManagedAttributeField
+ private String _siteUrl;
@ManagedAttributeField
private boolean _exposedAsMessageSource;
@ManagedAttributeField
@@ -84,109 +85,54 @@ public class NonJavaTrustStoreImpl
private volatile TrustManager[] _trustManagers = new TrustManager[0];
-
- static
- {
- Handler.register();
- }
-
- private X509Certificate[] _certificates;
+ private X509Certificate _x509Certificate;
@ManagedObjectFactoryConstructor
- public NonJavaTrustStoreImpl(final Map<String, Object> attributes, Broker<?> broker)
+ public SiteSpecificTrustStoreImpl(final Map<String, Object> attributes, Broker<?> broker)
{
super(parentsMap(broker), attributes);
_broker = broker;
}
@Override
- public String getCertificatesUrl()
+ public String getSiteUrl()
{
- return _certificatesUrl;
+ return _siteUrl;
}
-
@Override
- public List<Map<CertificateDetails,Object>> getCertificateDetails()
+ protected void postResolve()
{
- List<Map<CertificateDetails,Object>> certificateDetails = new ArrayList<>();
- if(_certificates != null)
+ if(getActualAttributes().containsKey(CERTIFICATE))
{
- for (X509Certificate certificate : _certificates)
- {
- Map<CertificateDetails, Object> details = new EnumMap<>(CertificateDetails.class);
-
- details.put(CertificateDetails.SUBJECT_NAME, getNameFromCertificate(certificate));
- details.put(CertificateDetails.ISSUER_NAME, certificate.getIssuerX500Principal().getName());
- details.put(CertificateDetails.VALID_START, certificate.getNotBefore());
- details.put(CertificateDetails.VALID_END, certificate.getNotAfter());
- certificateDetails.add(details);
- }
+ decodeCertificate();
}
- return certificateDetails;
- }
- private String getNameFromCertificate(final X509Certificate certificate)
- {
- String name;
- X500Principal subjectX500Principal = certificate.getSubjectX500Principal();
- name = getCommonNameFromPrincipal(subjectX500Principal);
-
- return name;
}
- private String getCommonNameFromPrincipal(final X500Principal subjectX500Principal)
+ @Override
+ public String getCertificate()
{
- String name;
- String dn = subjectX500Principal.getName();
try
{
- LdapName ldapDN = new LdapName(dn);
- name = dn;
- for (Rdn rdn : ldapDN.getRdns())
- {
- if (rdn.getType().equalsIgnoreCase("CN"))
- {
- name = String.valueOf(rdn.getValue());
- break;
- }
- }
-
+ return DatatypeConverter.printBase64Binary(_x509Certificate.getEncoded());
}
- catch (InvalidNameException e)
+ catch (CertificateEncodingException e)
{
- LOGGER.error("Error getting subject name from certificate");
- name = null;
+ throw new IllegalConfigurationException("Unable to encode certificate");
}
- return name;
}
-
@Override
public TrustManager[] getTrustManagers() throws GeneralSecurityException
{
-
return _trustManagers;
}
@Override
public Certificate[] getCertificates() throws GeneralSecurityException
{
- try
- {
- return SSLUtil.readCertificates(getUrlFromString(getCertificatesUrl()));
- }
- catch (IOException e)
- {
- throw new GeneralSecurityException(e);
- }
- }
-
- @Override
- public void onValidate()
- {
- super.onValidate();
- validateTrustStoreAttributes(this);
+ return new Certificate[]{_x509Certificate};
}
@StateTransition(currentState = {State.ACTIVE, State.ERRORED}, desiredState = State.DELETED)
@@ -239,83 +185,93 @@ public class NonJavaTrustStoreImpl
@StateTransition(currentState = {State.UNINITIALIZED, State.ERRORED}, desiredState = State.ACTIVE)
protected ListenableFuture<Void> doActivate()
{
- setState(State.ACTIVE);
- return Futures.immediateFuture(null);
- }
-
- @Override
- protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes)
- {
- super.validateChange(proxyForValidation, changedAttributes);
- NonJavaTrustStore changedStore = (NonJavaTrustStore) proxyForValidation;
- if (changedAttributes.contains(NAME) && !getName().equals(changedStore.getName()))
+ if(_x509Certificate == null)
{
- throw new IllegalConfigurationException("Changing the key store name is not allowed");
+ downloadCertificate();
}
- validateTrustStoreAttributes(changedStore);
- }
-
- private void validateTrustStoreAttributes(NonJavaTrustStore<?> keyStore)
- {
- try
+ if(_x509Certificate != null)
{
- SSLUtil.readCertificates(getUrlFromString(keyStore.getCertificatesUrl()));
+ generateTrustManagers();
+
+ setState(State.ACTIVE);
}
- catch (IOException | GeneralSecurityException e)
+ else
{
- throw new IllegalArgumentException("Cannot validate certificate(s):" + e, e);
+ setState(State.ERRORED);
}
+ return Futures.immediateFuture(null);
}
- @SuppressWarnings("unused")
- private void updateTrustManagers()
+ private void downloadCertificate()
{
try
{
- if (_certificatesUrl != null)
- {
- X509Certificate[] certs = SSLUtil.readCertificates(getUrlFromString(_certificatesUrl));
- java.security.KeyStore inMemoryKeyStore = java.security.KeyStore.getInstance(java.security.KeyStore.getDefaultType());
-
- inMemoryKeyStore.load(null, null);
- int i = 1;
- for(Certificate cert : certs)
- {
- inMemoryKeyStore.setCertificateEntry(String.valueOf(i++), cert);
- }
+ URL url = new URL(getSiteUrl());
+ SSLContext sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(new KeyManager[0], new TrustManager[] {new AlwaysTrustManager()}, null);
+
+ SSLSocket socket = (SSLSocket) sslContext.getSocketFactory().createSocket(url.getHost(), url.getPort());
+ socket.startHandshake();
+ final Certificate[] certificateChain =
+ socket.getSession().getPeerCertificates();
+ if(certificateChain != null && certificateChain.length != 0 && certificateChain[0] instanceof X509Certificate)
+ {
+ _x509Certificate = (X509Certificate) certificateChain[0];
+ final String certificate = getCertificate();
+ attributeSet(CERTIFICATE, certificate, certificate);
- TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
- tmf.init(inMemoryKeyStore);
- _trustManagers = tmf.getTrustManagers();
- _certificates = certs;
+ }
+ else
+ {
+ LOGGER.info("No valid certificates available from " + getSiteUrl());
}
}
- catch (IOException | GeneralSecurityException e)
+ catch (GeneralSecurityException | IOException e)
{
- throw new IllegalConfigurationException("Cannot load certificate(s) :" + e, e);
+ LOGGER.info("Unable to download certificate from " + getSiteUrl(), e);
}
}
- private URL getUrlFromString(String urlString) throws MalformedURLException
+
+ private void decodeCertificate()
{
- URL url;
+ byte[] certificateEncoded = DatatypeConverter.parseBase64Binary((String) getActualAttributes().get(CERTIFICATE));
- try
+
+ try(ByteArrayInputStream input = new ByteArrayInputStream(certificateEncoded))
{
- url = new URL(urlString);
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ _x509Certificate = (X509Certificate) cf.generateCertificate(input);
}
- catch (MalformedURLException e)
+ catch (CertificateException | IOException e)
{
- File file = new File(urlString);
- url = file.toURI().toURL();
-
+ throw new IllegalConfigurationException("Could not decode certificate", e);
}
- return url;
+
}
+ private void generateTrustManagers()
+ {
+ try
+ {
+ java.security.KeyStore inMemoryKeyStore = java.security.KeyStore.getInstance(java.security.KeyStore.getDefaultType());
+
+ inMemoryKeyStore.load(null, null);
+ inMemoryKeyStore.setCertificateEntry("1", _x509Certificate);
+
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ tmf.init(inMemoryKeyStore);
+ _trustManagers = tmf.getTrustManagers();
+
+ }
+ catch (IOException | GeneralSecurityException e)
+ {
+ throw new IllegalConfigurationException("Cannot load certificate(s) :" + e, e);
+ }
+ }
@Override
public boolean isExposedAsMessageSource()
@@ -334,4 +290,77 @@ public class NonJavaTrustStoreImpl
{
return _excludedVirtualHostMessageSources;
}
+
+ @Override
+ public String getCertificateIssuer()
+ {
+ return _x509Certificate == null ? null : _x509Certificate.getIssuerX500Principal().toString();
+ }
+
+
+ @Override
+ public String getCertificateSubject()
+ {
+ return _x509Certificate == null ? null : _x509Certificate.getSubjectX500Principal().toString();
+ }
+
+ @Override
+ public String getCertificateSerialNumber()
+ {
+ return _x509Certificate == null ? null : _x509Certificate.getSerialNumber().toString();
+ }
+
+ @Override
+ public String getCertificateSignature()
+ {
+ return _x509Certificate == null ? null : Functions.hex(_x509Certificate.getSignature(),4096, " ");
+ }
+
+ @Override
+ public String getCertificateValidFromDate()
+ {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, MMM d, YYYY 'at' HH:mm:ss z");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return _x509Certificate == null ? null : dateFormat.format(_x509Certificate.getNotBefore());
+ }
+
+
+ @Override
+ public String getCertificateValidUntilDate()
+ {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, MMM d, YYYY 'at' HH:mm:ss z");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return _x509Certificate == null ? null : dateFormat.format(_x509Certificate.getNotAfter());
+ }
+
+ @Override
+ public void refreshCertificate()
+ {
+ downloadCertificate();
+ }
+
+ private static class AlwaysTrustManager implements X509TrustManager
+ {
+ @Override
+ public void checkClientTrusted(final X509Certificate[] chain, final String authType)
+ throws CertificateException
+ {
+
+ }
+
+ @Override
+ public void checkServerTrusted(final X509Certificate[] chain, final String authType)
+ throws CertificateException
+ {
+
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers()
+ {
+ return new X509Certificate[0];
+ }
+ }
+
+
}
Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/add.js?rev=1686908&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/add.js (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/add.js Mon Jun 22 18:07:19 2015
@@ -0,0 +1,91 @@
+/*
+ *
+ * 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/dom",
+ "dojo/query",
+ "dojo/_base/array",
+ "dijit/registry",
+ "qpid/common/util",
+ "dojo/parser",
+ "dojo/text!store/sitespecifictruststore/add.html",
+ "dojo/domReady!"],
+ function (dom, query, array, registry, util, parser, template)
+ {
+ var addKeyStore =
+ {
+ show: function(data)
+ {
+ var that=this;
+ this.metadata = data.metadata
+ this.containerNode = data.containerNode;
+ data.containerNode.innerHTML = template;
+ parser.parse(this.containerNode).then(function(instances)
+ {
+
+ if (data.effectiveData)
+ {
+ that.update(data.effectiveData);
+ }
+
+ util.applyMetadataToWidgets(data.containerNode, "TrustStore", "SiteSpecificTrustStore", data.metadata);
+ if (data.effectiveData)
+ {
+ util.disableWidgetsForImmutableFields(data.containerNode, "TrustStore", "SiteSpecificTrustStore", data.metadata);
+ }
+ });
+ },
+ update: function(effectiveData)
+ {
+ var attributes = this.metadata.getMetaData("TrustStore", "SiteSpecificTrustStore").attributes;
+ var widgets = registry.findWidgets(this.containerNode);
+ array.forEach(widgets, function(item)
+ {
+ var name = item.id.replace("addStore.","");
+ if (name in attributes )
+ {
+ var attribute = attributes[name];
+ var value = effectiveData[name];
+ if (value)
+ {
+ if (attribute.secure)
+ {
+ if (!/^\*+/.test(value) )
+ {
+ item.set("value", value);
+ }
+ else
+ {
+ item.set("placeHolder", value);
+ item.set("required", false);
+ }
+ }
+ else
+ {
+ item.set("value", value);
+ }
+ }
+ }
+ });
+ }
+ };
+
+ return addKeyStore;
+ }
+);
Propchange: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/add.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/show.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/show.js?rev=1686908&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/show.js (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/show.js Mon Jun 22 18:07:19 2015
@@ -0,0 +1,49 @@
+/*
+ * 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",
+ "qpid/common/util",
+ "dojox/grid/DataGrid",
+ "qpid/common/UpdatableStore",
+ "dojo/domReady!"],
+ function (query, util, DataGrid, UpdatableStore)
+ {
+
+
+ function SiteSpecificTrustStore(data)
+ {
+ this.fields = [];
+ this.management = data.parent.management;
+ var attributes = this.management.metadata.getMetaData("TrustStore", "SiteSpecificTrustStore").attributes;
+ for(var name in attributes)
+ {
+ this.fields.push(name);
+ }
+ var that = this;
+ util.buildUI(data.containerNode, data.parent, "store/sitespecifictruststore/show.html", this.fields, this);
+ }
+
+ SiteSpecificTrustStore.prototype.update = function(data)
+ {
+ util.updateUI(data, this.fields, this);
+ }
+
+ return SiteSpecificTrustStore;
+ }
+);
Propchange: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/sitespecifictruststore/show.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/add.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/add.html?rev=1686908&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/add.html (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/add.html Mon Jun 22 18:07:19 2015
@@ -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 id="addStore.oldBrowserWarning" class="infoMessage hidden clear"></div>
+ <div class="clear">
+
+ <div class="clear">
+ <div class="formLabel-labelCell tableContainer-labelCell">Site URL:</div>
+ <div class="formLabel-controlCell tableContainer-valueCell">
+ <input type="text" id="addStore.siteUrl"
+ data-dojo-type="dijit/form/ValidationTextBox"
+ data-dojo-props="
+ name: 'siteUrl',
+ placeHolder: 'url',
+ promptMessage: 'URL for the site you wish to trust',
+ title: 'URL for the site you wish to trust'" />
+ </div>
+ </div>
+ </div>
+</div>
Propchange: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/add.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/show.html
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/show.html?rev=1686908&view=auto
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/show.html (added)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/show.html Mon Jun 22 18:07:19 2015
@@ -0,0 +1,53 @@
+<!--
+ ~ 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">Site URL:</div>
+ <div ><span class="siteUrl" ></span></div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell">Issuer:</div>
+ <div><span class="certificateIssuer" ></span></div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell">Serial No.:</div>
+ <div><span class="certificateSerialNumber" ></span></div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell">Subject:</div>
+ <div><span class="certificateSubject" ></span></div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell">Valid From:</div>
+ <div><span class="certificateValidFromDate" ></span></div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell">Valid Until:</div>
+ <div><span class="certificateValidUntilDate" ></span></div>
+ </div>
+ <div class="clear">
+ <div class="formLabel-labelCell">Signature:</div>
+ <div><span class="certificateSignature" ></span></div>
+ </div>
+
+
+ <div class="clear"></div>
+</div>
+
Propchange: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/store/sitespecifictruststore/show.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/util/Functions.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/util/Functions.java?rev=1686908&r1=1686907&r2=1686908&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/util/Functions.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/util/Functions.java Mon Jun 22 18:07:19 2015
@@ -107,13 +107,21 @@ public final class Functions
public static String hex(byte[] bytes, int limit)
{
+ return hex(bytes, limit, "");
+ }
+
+ public static String hex(byte[] bytes, int limit, CharSequence separator)
+ {
limit = Math.min(limit, bytes == null ? 0 : bytes.length);
StringBuilder sb = new StringBuilder(3 + limit*2);
for(int i = 0; i < limit; i++)
{
sb.append(HEX_CHARACTERS[(((int)bytes[i]) & 0xf0)>>4]);
sb.append(HEX_CHARACTERS[(((int)bytes[i]) & 0x0f)]);
-
+ if(i != bytes.length - 1)
+ {
+ sb.append(separator);
+ }
}
if(bytes != null && bytes.length>limit)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org