private final class KerberosServerEndpoint.ServerConnectionImpl extends KerberosUtil.Connection implements ServerConnection
Modifier and Type | Class and Description |
---|---|
private class |
KerberosServerEndpoint.ServerConnectionImpl.CacheKey
The key used for the softcache of this server endpoint.
|
private class |
KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl |
Modifier and Type | Field and Description |
---|---|
private GSSCredential |
clientCred |
private Subject |
clientSubject |
private boolean |
closed |
private KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl |
handleWithEncryption |
private KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl |
handleWithoutEncryption |
private InputStream |
istream |
private KerberosServerEndpoint.ListenHandleImpl |
listenHandle |
private Object |
lock |
private OutputStream |
ostream |
clientPrincipal, connectionLogger, dis, doDelegation, doEncryption, dos, gssContext, INTEGRITY_QOP, PRIVACY_QOP, sock
Constructor and Description |
---|
ServerConnectionImpl(Socket sock,
KerberosServerEndpoint.ListenHandleImpl listenHandle)
Construct a server connection
|
Modifier and Type | Method and Description |
---|---|
InvocationConstraints |
checkConstraints(InboundRequestHandle handle,
InvocationConstraints constraints)
Implements
InboundRequest.checkConstraints for a request with the
specified handle. |
void |
checkPermissions(InboundRequestHandle handle)
Implements
InboundRequest.checkPermissions for a request with the
specified handle. |
private KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl |
checkRequestHandle(Object h)
Make sure that the passed in inbound request handle has the
right type, and was previously instantiated in this
connection.
|
void |
close()
Close the connection
|
(package private) void |
establishContext()
Carry out the GSS context establishment message exchanges
|
SocketChannel |
getChannel()
Returns a socket channel that performs I/O on this connection,
or
null if no socket channel is available. |
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 handle,
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()
Returns a string representation of this object.
|
flush, read, write
private final KerberosServerEndpoint.ListenHandleImpl listenHandle
private GSSCredential clientCred
private Subject clientSubject
private InputStream istream
private OutputStream ostream
private KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl handleWithEncryption
private KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl handleWithoutEncryption
private final Object lock
private boolean closed
ServerConnectionImpl(Socket sock, KerberosServerEndpoint.ListenHandleImpl listenHandle) 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) throws IOException
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 requestIOException
- if an I/O exception occurspublic void checkPermissions(InboundRequestHandle handle)
ServerConnection
InboundRequest.checkPermissions
for a request with the
specified handle.checkPermissions
in interface ServerConnection
handle
- the handle for the requestpublic InvocationConstraints checkConstraints(InboundRequestHandle handle, InvocationConstraints constraints) throws UnsupportedConstraintException
ServerConnection
InboundRequest.checkConstraints
for a request with the
specified handle.checkConstraints
in interface ServerConnection
handle
- 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 handle, Collection context)
ServerConnection
InboundRequest.populateContext
for such requests; the context
may also be populated by the connection manager.populateContext
in interface ServerConnection
handle
- the handle for the requestcontext
- the context collection to populatepublic void close()
KerberosUtil.Connection
close
in interface ServerConnection
close
in class KerberosUtil.Connection
public String toString()
void establishContext() throws IOException, GSSException
IOException
GSSException
private KerberosServerEndpoint.ServerConnectionImpl.InboundRequestHandleImpl checkRequestHandle(Object h)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.