|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.jini.jeri.ssl.SslServerEndpoint
An implementation of ServerEndpoint that uses TLS/SSL to support
invocation constraints for direct communication over TCP sockets.
Instances of this class are intended to be created for use with the BasicJeriExporter class. Calls to enumerateListenEndpoints return instances of SslEndpoint.
This class supports at least the following constraints, possibly limited by the available cipher suites:
ClientAuthentication
ClientMaxPrincipal, when it contains an X500Principal
ClientMaxPrincipalType, when it contains
X500Principal
ClientMinPrincipal, when it contains a single
X500Principal only
ClientMinPrincipalType, when it contains
X500Principal only
Confidentiality
ConfidentialityStrength, a provider-specific constraint for
specifying weak or strong confidentiality
ConnectionAbsoluteTime, trivially, since this only takes effect
on the client side
ConnectionRelativeTime, trivially, since this only takes effect
on the client side
ConstraintAlternatives, if the elements all have the same
actual class and at least one element is supported
Delegation.NO
Delegation.YES, trivially, for anonymous clients
DelegationAbsoluteTime, trivially, when delegation is not
supported
DelegationRelativeTime, trivially, when delegation is not
supported
Integrity.YES
ServerAuthentication
ServerMinPrincipal, when it contains a single
X500Principal only
This class authenticates as a single Principal if the following
items are present in the server Subject:
X500Principal
CertPath, whose
getType method returns "X.509", and for which calling
getSubjectDN on the certificate chain's first element
returns that principal's name
X500PrivateCredential, stored as a private credential, whose
getCertificate method returns a value equal to the first
element of the certificate chain, and whose getPrivateKey
method returns the associated private key
In addition, this class will only dispatch remote calls that authenticate as
a given principal if the caller of listen on the class's
ServerEndpoint.ListenEndpoint has been granted AuthenticationPermission with that principal as the local principal, the
principal representing the authenticated identity of the client for the call
(if any) as the peer principal, and the accept action.
This class supports remote connections between authenticated servers and
authenticated or anonymous clients, and between anonymous servers and
anonymous clients. Connections between anonymous servers and authenticated
clients are not supported. Because of the suites available in the TLS/SSL
protocol, support for Confidentiality.NO requires the server to
authenticate with an RSA public key.
If the server subject contains principals and credentials that would permit
authentication of more than one X500Principal, the endpoint
will make an arbitrary choice of the principal to use for authentication,
and will continue to make the same choice so long as subject contents,
validity of credentials, and security permissions do not change.
The host name specified when creating an SslServerEndpoint
instance controls the host name that will be contained in
SslEndpoint instances produced when enumerateListenEndpoints is invoked to listen on
the server endpoint; the host name does not affect the behavior of the
listen operation itself, which listens on all of the local system's network
addresses. If the host name in the server endpoint is null,
then the host name in the SslEndpoint instances that it
produces will be the default server host name, which is the IP address
string of the InetAddress returned by InetAddress.getLocalHost when
enumerateListenEndpoints is invoked.
This class permits specifying a SocketFactory for creating the
Socket instances that the associated SslEndpoint
instances use to make remote connections back to the server, and a ServerSocketFactory for creating the ServerSocket instances that
the server endpoint uses to accept remote connections. These socket
factories and sockets should not implement the TLS/SSL protocol; it is the
responsibility of the implementation to establish TLS/SSL connections over
the sockets it obtains from the socket factories. In particular, instances
of SSLSocketFactory and SSLServerSocketFactory should not be
used, and the factories used should not return instances of SSLSocket or SSLServerSocket.
A SocketFactory used with instances of this class should be
serializable, and must implement Object.equals to obey
the guidelines that are specified for equals methods of Endpoint instances. A ServerSocketFactory used with instances
of this class must implement Object.equals to obey the
guidelines that are specified for equals methods of ListenEndpoint instances.
This class uses the Jini(TM) extensible remote invocation (Jini ERI) multiplexing protocol to map outgoing requests to socket connections.
SslEndpoint,
ConfidentialityStrength
This implementation uses the ServerConnectionManager class to manage
connections.
This implementation uses the following Logger instances in the
net.jini.jeri.ssl namespace:
| Level | Description |
|---|---|
WARNING | problems with initializing JSSE |
| Level | Description |
|---|---|
INFO | problems with accepting or handling server connections, or with handling inbound requests |
FAILED | problems with checking constraints or permissions, with enumerating listen endpoints, or with security issues for inbound requests |
HANDLED | exceptions caught involving authentication |
FINE | creating server endpoints, enumerating listen endpoints, creating or closing connections or listen handles, or checking constraints for endpoints or inbound requests |
FINEST | low level operation tracing |
This implementation uses the following security providers:
SSLContext, with the protocol specified by the
com.sun.jini.jeri.ssl.sslProtocol system property, or
"TLS" if that property is not defined, to provide the
TLS/SSL implementation. The SSLContext.init
method is called with null for the random
parameter to use the default SecureRandom implementation.
CertificateFactory, with type "X.509", to generate
CertPath instances from X.509 certificate chains
TrustManagerFactory, with the algorithm specified by the
com.sun.jini.jeri.ssl.trustManagerFactoryAlgorithm system
property, or the default algorithm if that property is not defined, to
implement trust management for the TLS/SSL implementation. The factory
must return trust managers that implement X509TrustManager.
See the documentation on installing security providers and configuring JSSE for information on configuring these providers.
The JSSE documentation also describes the system properties for configuring the location, type, and password of the truststore that this implementation uses, through JSSE, to make decisions about what certificate chains should be trusted.
This implementation recognizes the following system properties:
com.sun.jini.jeri.ssl.maxServerSessionDuration - The
maximum number of milliseconds a server-side TLS/SSL session should be
used before expiring. The default is 24 hours. The value used should be
larger than the maximum client session duration to allow the client to
negotiate a new session before the server timeout occurs.
com.sun.jini.jeri.ssl.sslProtocol - The secure socket
protocol used when obtaining SSLContext instances. The default
is "TLS".
com.sun.jini.jeri.ssl.trustManagerFactoryAlgorithm - The
algorithm used when obtaining TrustManagerFactory
instances. The default is the value returned by TrustManagerFactory.getDefaultAlgorithm.
com.sun.jini.jeri.ssl.cipherSuites - The TLS/SSL cipher
suites that should be used for communication. The default is the list
of suites supported by the JSSE implementation. The value should
specify the suite names, separated by commas. The value will be ignored
if it contains no suites or specifies suites that are not supported by
the JSSE implementation. Suites appearing earlier in the list will be
preferred to ones appearing later for suites that support the same
requirements and preferences.
| Nested Class Summary |
| Nested classes inherited from class net.jini.jeri.ServerEndpoint |
ServerEndpoint.ListenContext, ServerEndpoint.ListenCookie, ServerEndpoint.ListenEndpoint, ServerEndpoint.ListenHandle |
| Method Summary | |
InvocationConstraints |
checkConstraints(InvocationConstraints constraints)
Checks that it is possible to receive requests that either fully or partially satisfy the specified requirements, and returns any constraints that must be fully or partially implemented by higher layers in order to fully satisfy all of the specified requirements. |
Endpoint |
enumerateListenEndpoints(ServerEndpoint.ListenContext listenContext)
Enumerates the communication endpoints represented by this ServerEndpoint by passing the ListenEndpoint
for each of them to listenContext, which will ensure an
active listen operation on each endpoint, and returns an
Endpoint instance corresponding to the listen operations
chosen by listenContext. |
boolean |
equals(Object object)
Two instances of this class are equal if they have server subjects that compare equal using ==; have server principals that are
either both null or are equal when compared as the elements
of a Set; have the same values for server host and port; have
socket factories that are either both null, or have the
same actual class and are equal; and have server socket factories
that are either both null, or have the same actual class
and are equal. |
String |
getHost()
Returns the host name that will be used in SslEndpoint instances
created by listening on this object, or null if enumerateListenEndpoints will use the default
server host. |
static SslServerEndpoint |
getInstance(int port)
Returns a TLS/SSL server endpoint for the specified port. |
static SslServerEndpoint |
getInstance(String serverHost,
int port)
Returns a TLS/SSL server endpoint for the specified server host and port. |
static SslServerEndpoint |
getInstance(String serverHost,
int port,
SocketFactory socketFactory,
ServerSocketFactory serverSocketFactory)
Returns a TLS/SSL server endpoint for the specified server host, port, and socket factories. |
static SslServerEndpoint |
getInstance(Subject serverSubject,
X500Principal[] serverPrincipals,
String serverHost,
int port)
Returns a TLS/SSL server endpoint for the specified server subject, server principals, server host, and port. |
static SslServerEndpoint |
getInstance(Subject serverSubject,
X500Principal[] serverPrincipals,
String serverHost,
int port,
SocketFactory socketFactory,
ServerSocketFactory serverSocketFactory)
Returns a TLS/SSL server endpoint for the specified server subject, server principals, server host, port, and socket factories. |
int |
getPort()
Returns the TCP port on which this object listens for connections, or 0 if it selects a free port. |
Set |
getPrincipals()
Returns an immutable set of the principals that this instance uses for authentication, or null if it is anonymous. |
ServerSocketFactory |
getServerSocketFactory()
Returns the server socket factory that this server endpoint uses to create ServerSocket instances, or null if it uses
default server sockets. |
SocketFactory |
getSocketFactory()
Returns the socket factory that the associated SslEndpoint
instances created by listening on this server endpoint use to create
Socket instances, or null if they use default
sockets. |
int |
hashCode()
Returns a hash code value for this object. |
String |
toString()
Returns a string representation of this object. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
public static SslServerEndpoint getInstance(int port)
null server host (which requests that enumerateListenEndpoints compute the default
server host), the subject associated with the current access control
context, the principals in the subject with appropriate public and
private credentials for which the caller has AuthenticationPermission to listen, and null socket
factories to create default sockets. A port of
0 requests listening on any free port.
port - the port on which to listen for connections, or
0 for any free port
SslServerEndpoint instance
IllegalArgumentException - if port is negative or
greater than 65535
public static SslServerEndpoint getInstance(String serverHost,
int port)
AuthenticationPermission to listen, and null socket
factories to create default sockets. A serverHost of
null requests that enumerateListenEndpoints compute the default server host. A
port of 0 requests listening on any free port.
serverHost - the name that clients should use to connect to this
server, or null to use the defaultport - the port on which to listen for connections, or
0 for any free port
SslServerEndpoint instance
IllegalArgumentException - if port is negative or
greater than 65535
public static SslServerEndpoint getInstance(String serverHost,
int port,
SocketFactory socketFactory,
ServerSocketFactory serverSocketFactory)
AuthenticationPermission to listen. A serverHost of
null requests that enumerateListenEndpoints compute the default server host. A
port of 0 requests listening on any free
port. A socketFactory of null uses default
sockets in the associated SslEndpoint. A
serverSocketFactory of null uses default
server sockets.
serverHost - the name that clients should use to connect to this
server, or null to use the defaultport - the port on which to listen for connections, or
0 for any free portsocketFactory - the socket factory for use in the associated
SslEndpoint instances, or nullserverSocketFactory - the server socket factory, or
null
SslServerEndpoint instance
IllegalArgumentException - if port is negative or
greater than 65535
public static SslServerEndpoint getInstance(Subject serverSubject,
X500Principal[] serverPrincipals,
String serverHost,
int port)
null socket
factories to create default sockets. A serverSubject of
null uses the subject associated with the current access
control context. A serverPrincipals of null
uses the principals in the subject with appropriate public and private
credentials for which the caller has AuthenticationPermission to
listen; otherwise that argument specifies the principals to use, or that
the server should be anonymous if the argument has no elements. If
non-null, the value of serverPrincipals is
neither retained nor modified; subsequent changes to that argument have
no effect on the instance created. A serverHost of
null requests that enumerateListenEndpoints compute the default server host. A
port of 0 requests listening on any free port.
serverSubject - the Subject to use for authenticating
the server or null to use the current subjectserverPrincipals - the principals to use for authenticating the
server, or null to use any available principals in
the subjectserverHost - the name that clients should use to connect to this
server, or null to use the defaultport - the port on which to listen for connections, or
0 for any free port
SslServerEndpoint instance
IllegalArgumentException - if port is negative or
greater than 65535
NullPointerException - if serverPrincipals is not
null and any of its elements are null
public static SslServerEndpoint getInstance(Subject serverSubject,
X500Principal[] serverPrincipals,
String serverHost,
int port,
SocketFactory socketFactory,
ServerSocketFactory serverSocketFactory)
serverSubject of null uses the subject
associated with the current access control context. A
serverPrincipals of null uses the principals
in the subject with appropriate public and private credentials for which
the caller has AuthenticationPermission to listen; otherwise
that argument specifies the principals to use, or that the server should
be anonymous if the argument has no elements. If non-null,
the value of serverPrincipals is neither retained nor
modified; subsequent changes to that argument have no effect on the
instance created. A serverHost of null
requests that enumerateListenEndpoints
compute the default server host. A port of 0
requests listening on any free port. A socketFactory of
null uses default sockets in the associated SslEndpoint. A serverSocketFactory of null
uses default server sockets.
serverSubject - the Subject to use for authenticating
the server or null to use the current subjectserverPrincipals - the principals to use for authenticating the
server, or null to use any available principals in
the subjectserverHost - the name that clients should use to connect to this
server, or null to use the defaultport - the port on which to listen for connections, or
0 for any free portsocketFactory - the socket factory for use in the associated
SslEndpoint instances, or nullserverSocketFactory - the server socket factory, or
null
SslServerEndpoint instance
IllegalArgumentException - if port is negative or
greater than 65535
NullPointerException - if serverPrincipals is not
null and any of its elements are nullpublic String getHost()
SslEndpoint instances
created by listening on this object, or null if enumerateListenEndpoints will use the default
server host.
SslEndpoint instances
created by listening on this object, or null if
using the defaultpublic int getPort()
0 if it selects a free port.
0 if it selects a free portpublic Set getPrincipals()
null if it is anonymous.
nullpublic SocketFactory getSocketFactory()
SslEndpoint
instances created by listening on this server endpoint use to create
Socket instances, or null if they use default
sockets.
null if they use default socketspublic ServerSocketFactory getServerSocketFactory()
ServerSocket instances, or null if it uses
default server sockets.
null if it uses default
server socketspublic String toString()
public InvocationConstraints checkConstraints(InvocationConstraints constraints)
throws UnsupportedConstraintException
This implementation only returns Integrity.YES constraints.
checkConstraints in interface ServerCapabilitiesconstraints - the constraints that must be supported
SecurityException - if the current security context does not have
the permissions necessary to perform this operation
NullPointerException - if constraints is
null
UnsupportedConstraintException - if the transport layer
aspects of any of the specified requirements are not supported
by this instance (either in general or in the current security
context)public int hashCode()
public boolean equals(Object object)
==; have server principals that are
either both null or are equal when compared as the elements
of a Set; have the same values for server host and port; have
socket factories that are either both null, or have the
same actual class and are equal; and have server socket factories
that are either both null, or have the same actual class
and are equal.
public Endpoint enumerateListenEndpoints(ServerEndpoint.ListenContext listenContext)
throws IOException
ServerEndpoint by passing the ListenEndpoint
for each of them to listenContext, which will ensure an
active listen operation on each endpoint, and returns an
Endpoint instance corresponding to the listen operations
chosen by listenContext.
If this server endpoint's server host is null, then the
endpoint returned will contain the default server host. This method
computes the default by invoking InetAddress.getLocalHost to obtain an InetAddress for the
local host. If InetAddress.getLocalHost throws an
exception, this method throws that exception. The default host name will
be the string returned by invoking getHostAddress on that InetAddress. If there is a security
manager, its checkConnect method will be invoked with the string returned by
invoking getHostName on that same
InetAddress as the host argument and -1 as the
port argument; this could result in a
SecurityException.
If this server endpoint's ServerSocketFactory is not
null, then the listen method
defined on the ListenEndpoint this method passes to
listenContext will create new ServerSocket
instances by invoking one of the factory's
createServerSocket methods that returns bound server
sockets, and otherwise it will create server sockets directly.
If there is a security manager, the checkPermissions and listen methods defined on the listen
endpoint will call the security manager's checkListen method, as well as requiring
the caller to have AuthenticationPermission with all the
server principals specified in the server endpoint and the
listen action.
enumerateListenEndpoints in interface ServerEndpointlistenContext - the ListenContext to pass
this ServerEndpoint's ListenEndpoint
instances to
Endpoint instance for sending requests
to this ServerEndpoint's communication endpoints
being listened on
SecurityException - if there is a security manager, and either its
checkListen method fails,
or serverHost is null and the security
manager's checkConnect
method fails; or if the calling thread does not have permission
to authenticate as each of the endpoint's server principals when
listening for connections
IllegalArgumentException - if an invocation of the
addListenEndpoint method on the supplied
ListenContext returns a ListenCookie
that does not correspond to the ListenEndpoint that
was passed to it
NullPointerException - if listenContext is
null
UnknownHostException - if this instance's server host
is null and InetAddress.getLocalHost
throws an UnknownHostException
UnsupportedConstraintException - if the server subject is missing
any of the endpoint's server principals or the associated
credentials
IOException - if an I/O exception occurs while attempting
to listen for requests on the communication endpoints
represented by this ServerEndpoint. This could
occur, for example, if an I/O resource associated with one of
the communication endpoints is already in exclusive use, or if
there are insufficient I/O resources for the operation.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||