DirectoryRMIServerSocketFactory.java revision b8c6b80da1cb6118167a934daa480eb381c59e0e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* A <code>DirectoryRMIServerSocketFactory</code> instance is used by the RMI
* runtime in order to obtain server sockets for RMI calls via SSL.
*
* <p>
* This class implements <code>RMIServerSocketFactory</code> over the Secure
* Sockets Layer (SSL) or Transport Layer Security (TLS) protocols.
* </p>
*/
public class DirectoryRMIServerSocketFactory implements
{
/**
* The SSL socket factory associated with the connector.
*/
private SSLSocketFactory sslSocketFactory;
/**
* Indicate if we required the client authentication via SSL.
*/
private final boolean needClientCertificate;
/**
* Constructs a new <code>DirectoryRMIServerSocketFactory</code> with the
* specified SSL socket configuration.
*
* @param sslSocketFactory
* the SSL socket factory to be used by this factory
*
* @param needClientCertificate
* <code>true</code> to require client authentication on SSL
* connections accepted by server sockets created by this
* factory; <code>false</code> to not require client
* authentication.
*/
boolean needClientCertificate)
{
// Initialize the configuration parameters.
this.sslSocketFactory = sslSocketFactory;
}
/**
* <p>
* Returns <code>true</code> if client authentication is required on SSL
* connections accepted by server sockets created by this factory.
* </p>
*
* @return <code>true</code> if client authentication is required
*
* @see SSLSocket#setNeedClientAuth
*/
public final boolean getNeedClientCertificate()
{
return needClientCertificate;
}
/**
* Creates a server socket that accepts SSL connections configured according
* to this factory's SSL socket configuration parameters.
*
* @param port
* the port number the socket listens to
*
* @return a server socket
*
* @throws IOException
* if the socket cannot be created
*/
{
{
{
if (logger.isTraceEnabled())
{
}
true);
sslSocket.setUseClientMode(false);
return sslSocket;
}
};
}
/**
* <p>
* Indicates whether some other object is "equal to" this one.
* </p>
*
* <p>
* Two <code>CacaoRMIServerSocketFactory</code> objects are equal if they
* have been constructed with the same SSL socket configuration parameters.
* </p>
*
* <p>
* A subclass should override this method (as well as {@link #hashCode()})
* if it adds instance state that affects equality.
* </p>
*
* @param obj the reference object with which to compare.
*
* @return <code>true</code> if this object is the same as the obj
* argument <code>false</code> otherwise.
*/
{
if (obj == this)
{
return true;
}
if (!(obj instanceof DirectoryRMIServerSocketFactory))
{
return false;
}
}
/**
* Checks if inputs parameters are OK.
* @param that the input parameter
* @return true or false.
*/
{
}
/**
* <p>Returns a hash code value for this
* <code>CacaoRMIServerSocketFactory</code>.</p>
*
* @return a hash code value for this
* <code>CacaoRMIServerSocketFactory</code>.
*/
public int hashCode()
{
}
}