
com.sun.messaging.jmq.management.DefaultTrustManager Maven / Gradle / Ivy
/*
* Copyright (c) 2000, 2017 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package com.sun.messaging.jmq.management;
import javax.net.ssl.X509TrustManager;
import java.security.cert.X509Certificate;
/**
* The default trust manager.
*
* TBD: Need to describe *when* this class is used i.e. what JMX configuration properties trigger it's use.
*
*
* If this class is used, the client does not require to install/configure server certificates because all server certs
* are accepted.
*
*
* This is useful for intra-net applications where servers are inside firewall and are treated as trusted.
*/
public class DefaultTrustManager implements X509TrustManager {
private boolean debug = false;
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {
if (debug) {
System.err.println("default trust manager is called to validate certs ...");
System.err.println("returning 'true' for isServerTrusted call ...");
}
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}