Package org.apache.sshd.common.session
Interface SessionContext
- All Superinterfaces:
AttributeRepository,AttributeStore,AutoCloseable,Channel,Closeable,Closeable,ConnectionEndpointsIndicator,PropertyResolver,SessionHeartbeatController,UsernameHolder
- All Known Subinterfaces:
ClientSession,ServerSession,Session
- All Known Implementing Classes:
AbstractClientSession,AbstractServerSession,AbstractSession,ClientSessionImpl,ServerSessionImpl,SessionHelper
public interface SessionContext
extends ConnectionEndpointsIndicator, UsernameHolder, SessionHeartbeatController, AttributeStore, Closeable
A "succinct" summary of the most important attributes of an SSH session
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>Nested classes/interfaces inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
SessionHeartbeatController.HeartbeatType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault prefix expected for the client / server identification stringstatic final StringBackward compatible special prefixstatic final intMaximum number of characters for any single line sent as part of the initial handshake - according to RFC 4253 - section 4.2:Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY -
Method Summary
Modifier and TypeMethodDescriptiongetCipherInformation(boolean incoming) Retrieves current cipher information - Note: may change if key re-exchange executedRetrieve the client version for this session.getCompressionInformation(boolean incoming) Retrieves current compression information - Note: may change if key re-exchange executedgetMacInformation(boolean incoming) Retrieves current MAC information - Note: may change if key re-exchange executedgetNegotiatedKexParameter(KexProposalOption paramType) Retrieve one of the negotiated values during the KEX stageRetrieve the server version for this session.byte[]booleanstatic booleanisDataIntegrityTransport(SessionContext session) static booleanisSecureSessionTransport(SessionContext session) booleanQuick indication if this is a server or client session (instead of having to askinstanceof).static booleanisValidSessionPayloadSize(long value) static booleanisValidVersionPrefix(String version) static longvalidateSessionPayloadSize(long value, String format) Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount, resolveAttributeMethods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttributeMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListenerMethods inherited from interface org.apache.sshd.common.util.net.ConnectionEndpointsIndicator
getLocalAddress, getRemoteAddressMethods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmptyMethods inherited from interface org.apache.sshd.common.session.SessionHeartbeatController
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeatMethods inherited from interface org.apache.sshd.common.auth.UsernameHolder
getUsername
-
Field Details
-
DEFAULT_SSH_VERSION_PREFIX
Default prefix expected for the client / server identification string- See Also:
-
FALLBACK_SSH_VERSION_PREFIX
Backward compatible special prefix- See Also:
-
MAX_VERSION_LINE_LENGTH
static final int MAX_VERSION_LINE_LENGTHMaximum number of characters for any single line sent as part of the initial handshake - according to RFC 4253 - section 4.2:The maximum length of the string is 255 characters, including the Carriage Return and Line Feed.- See Also:
-
-
Method Details
-
getSessionId
byte[] getSessionId()- Returns:
- A clone of the established session identifier -
nullif not yet established
-
isServerSession
boolean isServerSession()Quick indication if this is a server or client session (instead of having to askinstanceof).- Returns:
trueif this is a server session
-
getClientVersion
String getClientVersion()Retrieve the client version for this session.- Returns:
- the client version - may be
null/empty if versions not yet exchanged
-
getClientKexProposals
Map<KexProposalOption,String> getClientKexProposals()- Returns:
- An un-modifiable map of the latest KEX client proposal options May be empty if KEX not yet completed or re-keying in progress
- See Also:
-
getServerVersion
String getServerVersion()Retrieve the server version for this session.- Returns:
- the server version - may be
null/empty if versions not yet exchanged
-
getServerKexProposals
Map<KexProposalOption,String> getServerKexProposals()- Returns:
- An un-modifiable map of the latest KEX client proposal options. May be empty if KEX not yet completed or re-keying in progress
- See Also:
-
getKexState
KexState getKexState() -
getKexNegotiationResult
Map<KexProposalOption,String> getKexNegotiationResult() -
getNegotiatedKexParameter
Retrieve one of the negotiated values during the KEX stage- Parameters:
paramType- The requestKexProposalOptionvalue - ignored ifnull- Returns:
- The negotiated parameter value -
nullif invalid parameter or no negotiated value. - See Also:
-
getCipherInformation
Retrieves current cipher information - Note: may change if key re-exchange executed- Parameters:
incoming- Iftruethen the cipher for the incoming data, otherwise for the outgoing data- Returns:
- The
CipherInformation- ornullif not negotiated yet.
-
getCompressionInformation
Retrieves current compression information - Note: may change if key re-exchange executed- Parameters:
incoming- Iftruethen the compression for the incoming data, otherwise for the outgoing data- Returns:
- The
CompressionInformation- ornullif not negotiated yet.
-
getMacInformation
Retrieves current MAC information - Note: may change if key re-exchange executed- Parameters:
incoming- Iftruethen the MAC for the incoming data, otherwise for the outgoing data- Returns:
- The
MacInformation- ornullif not negotiated yet.
-
isAuthenticated
boolean isAuthenticated()- Returns:
trueif session has successfully completed the authentication phase
-
isValidVersionPrefix
- Parameters:
version- The reported client/server version- Returns:
trueif version not empty and starts with either "SSH-2.0-" or "SSH-1.99-"
-
isSecureSessionTransport
- Parameters:
session- TheSessionContextto be examined- Returns:
trueif the context is notnulland the ciphers have been established to anything other than "none".- See Also:
-
isDataIntegrityTransport
- Parameters:
session- TheSessionContextto be examined- Returns:
trueif the context is notnulland the MAC(s) used to verify packet integrity have been established.- See Also:
-
isValidSessionPayloadSize
static boolean isValidSessionPayloadSize(long value) -
validateSessionPayloadSize
-