class SslServerEndpointImpl.SslServerConnection extends Utilities implements ServerConnection
Utilities.SSLContextInfo
Modifier and Type | Field and Description |
---|---|
private AuthenticationPermission |
authPermission
The authentication permission required for this connection, or null
if the server is anonymous -- depends on session being set.
|
private String |
cipherSuite
The cipher suite -- depends on session being set.
|
private X500Principal |
clientPrincipal
The client principal -- depends on session being set.
|
private Subject |
clientSubject
The client subject -- depends on session being set.
|
(package private) boolean |
closed
True if the connection has been closed.
|
private SslServerEndpointImpl.SslListenHandle |
listenHandle
The listen handle that accepted this connection
|
private InboundRequestHandle |
requestHandle
The inbound request handle for this connection.
|
private X500Principal |
serverPrincipal
The server principal -- depends on session being set.
|
private SSLSession |
session
The session for this connection's socket, or null if not retrieved
yet.
|
(package private) SSLSocket |
sslSocket
The JSSE socket used for communication
|
ANY_KEY_ALGORITHM, clientLogger, DSA_KEY_ALGORITHM, getSubjectPermission, initLogger, INTEGRITY_PREFERRED, INTEGRITY_REQUIRED, RSA_KEY_ALGORITHM, serverLogger, UNKNOWN_PRINCIPAL
Constructor and Description |
---|
SslServerConnection(SslServerEndpointImpl.SslListenHandle listenHandle,
Socket socket)
Creates a server connection
|
Modifier and Type | Method and Description |
---|---|
private void |
check(InboundRequestHandle requestHandle)
Checks that the argument is the request handle for this connection.
|
InvocationConstraints |
checkConstraints(InboundRequestHandle requestHandle,
InvocationConstraints constraints)
Implements
InboundRequest.checkConstraints for a request with the
specified handle. |
void |
checkPermissions(InboundRequestHandle requestHandle)
Implements
InboundRequest.checkPermissions for a request with the
specified handle. |
void |
close()
Closes this connection.
|
(package private) void |
closeInternal(boolean removeFromListener)
Like close, but does not call noteConnectionClosed unless
removeFromListener is true.
|
private void |
decacheSession()
Make sure the cached session is up to date, and set session-related
fields if needed.
|
SocketChannel |
getChannel()
Returns a socket channel that performs I/O on this connection,
or
null if no socket channel is available. |
private Subject |
getClientSubject(SSLSocket socket)
Returns the read-only
Subject associated with the
client host connected to the other end of the connection on the
specified SSLSocket . |
InputStream |
getInputStream()
Returns an input stream that reads data from this connection.
|
OutputStream |
getOutputStream()
Returns an output stream that writes data to this connection.
|
void |
populateContext(InboundRequestHandle requestHandle,
Collection context)
Populates the supplied collection with context information
representing a request with the specified handle.
|
InboundRequestHandle |
processRequestData(InputStream in,
OutputStream out)
Reads from the specified input stream any per-request data required by
this connection for an inbound request, writes any required response
data to the specified output stream, and returns a handle for the
request.
|
String |
toString() |
checkValidity, contains, doesEncryption, doesServerAuthentication, equals, firstX509Cert, getCertFactory, getCipherAlgorithm, getClassName, getClientPrincipals, getClientPrincipals, getClientSSLContextInfo, getKeyAlgorithm, getKeyExchangeAlgorithm, getPermittedKeyAlgorithms, getServerPrincipals, getServerSSLContextInfo, getSupportedCipherSuites, hasStrongCipherAlgorithm, logThrow, maintainsIntegrity, permittedKeyAlgorithm, position, releaseClientSSLContextInfo, safeEquals, subjectString, toString
private final SslServerEndpointImpl.SslListenHandle listenHandle
final SSLSocket sslSocket
private final InboundRequestHandle requestHandle
private final SSLSession session
private final Subject clientSubject
private final X500Principal clientPrincipal
private final X500Principal serverPrincipal
private final AuthenticationPermission authPermission
private final String cipherSuite
volatile boolean closed
SslServerConnection(SslServerEndpointImpl.SslListenHandle listenHandle, Socket socket) throws IOException
IOException
public InputStream getInputStream() throws IOException
ServerConnection
getInputStream
in interface ServerConnection
IOException
- if an I/O exception occurspublic OutputStream getOutputStream() throws IOException
ServerConnection
getOutputStream
in interface ServerConnection
IOException
- if an I/O exception occurspublic SocketChannel getChannel()
ServerConnection
null
if no socket channel is available. If a
non-null
socket channel is returned, it is
connected.getChannel
in interface ServerConnection
null
public InboundRequestHandle processRequestData(InputStream in, OutputStream out)
ServerConnection
This method is invoked by
ServerConnectionManager
with the request input
stream and the response output stream of the InboundRequest
that it creates for the request when the
request is first received. This method reads information that
was sent by Connection.writeRequestData
and writes information to be read
by Connection.readResponseData
. This method can be used, for
example, to process per-request information about delegation,
client authentication, or client privileges.
If, for security reasons, this method determines that the
request must not be processed further (for example, because
client authentication failed), this method should close the
response output stream and throw a
SecurityException
after writing any response data.
There may be multiple requests in progress concurrently over this connection, and data read from and written to the specified streams may be buffered and multiplexed with data from other requests on this connection's underlying streams. Therefore, this method should only read data from the request input stream and write data to the response output stream and must not otherwise read from or write to this connection's underlying streams.
processRequestData
in interface ServerConnection
in
- the request input stream of the requestout
- the response output stream of the requestprivate void decacheSession()
private Subject getClientSubject(SSLSocket socket)
Subject
associated with the
client host connected to the other end of the connection on the
specified SSLSocket
. Returns null if the client is
anonymous.public void checkPermissions(InboundRequestHandle requestHandle)
ServerConnection
InboundRequest.checkPermissions
for a request with the
specified handle.checkPermissions
in interface ServerConnection
requestHandle
- the handle for the requestprivate void check(InboundRequestHandle requestHandle)
public InvocationConstraints checkConstraints(InboundRequestHandle requestHandle, InvocationConstraints constraints) throws UnsupportedConstraintException
ServerConnection
InboundRequest.checkConstraints
for a request with the
specified handle.checkConstraints
in interface ServerConnection
requestHandle
- the handle for the requestconstraints
- the constraints that must be satisfiedUnsupportedConstraintException
- if the transport layer
aspects of any of the specified requirements are not satisfied
by this requestpublic void populateContext(InboundRequestHandle requestHandle, Collection context)
ServerConnection
InboundRequest.populateContext
for such requests; the context
may also be populated by the connection manager.populateContext
in interface ServerConnection
requestHandle
- the handle for the requestcontext
- the context collection to populatepublic void close() throws IOException
ServerConnection
close
in interface ServerConnection
IOException
- if an I/O exception occursvoid closeInternal(boolean removeFromListener) throws IOException
IOException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.