public interface SessionContext extends ConnectionEndpointsIndicator, UsernameHolder, SessionHeartbeatController, AttributeStore, Closeable
SessionHeartbeatController.HeartbeatType
AttributeRepository.AttributeKey<T>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SSH_VERSION_PREFIX
Default prefix expected for the client / server identification string
|
static String |
FALLBACK_SSH_VERSION_PREFIX
Backward compatible special prefix
|
static int |
MAX_VERSION_LINE_LENGTH
Maximum number of characters for any single line sent as part of the initial handshake - according to
RFC 4253 - section 4.2:
|
EMPTY
Modifier and Type | Method and Description |
---|---|
CipherInformation |
getCipherInformation(boolean incoming)
Retrieves current cipher information - Note: may change if key re-exchange executed
|
Map<KexProposalOption,String> |
getClientKexProposals() |
String |
getClientVersion()
Retrieve the client version for this session.
|
CompressionInformation |
getCompressionInformation(boolean incoming)
Retrieves current compression information - Note: may change if key re-exchange executed
|
Map<KexProposalOption,String> |
getKexNegotiationResult() |
KexState |
getKexState() |
MacInformation |
getMacInformation(boolean incoming)
Retrieves current MAC information - Note: may change if key re-exchange executed
|
String |
getNegotiatedKexParameter(KexProposalOption paramType)
Retrieve one of the negotiated values during the KEX stage
|
Map<KexProposalOption,String> |
getServerKexProposals() |
String |
getServerVersion()
Retrieve the server version for this session.
|
byte[] |
getSessionId() |
boolean |
isAuthenticated() |
static boolean |
isDataIntegrityTransport(SessionContext session) |
static boolean |
isSecureSessionTransport(SessionContext session) |
boolean |
isServerSession()
Quick indication if this is a server or client session (instead of having to ask
instanceof ). |
static boolean |
isValidSessionPayloadSize(long value) |
static boolean |
isValidVersionPrefix(String version) |
static long |
validateSessionPayloadSize(long value,
String format) |
getLocalAddress, getRemoteAddress
getUsername
disableSessionHeartbeat, getSessionHeartbeatInterval, getSessionHeartbeatType, setSessionHeartbeat, setSessionHeartbeat
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty, isEmpty, isEmpty
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
attributeKeys, getAttribute, getAttributesCount, ofAttributesMap, ofKeyValuePair, resolveAttribute
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
static final String DEFAULT_SSH_VERSION_PREFIX
static final String FALLBACK_SSH_VERSION_PREFIX
static final int MAX_VERSION_LINE_LENGTH
The maximum length of the string is 255 characters,
including the Carriage Return and Line Feed.
byte[] getSessionId()
null
if not yet establishedboolean isServerSession()
instanceof
).true
if this is a server sessionString getClientVersion()
null
/empty if versions not yet exchangedMap<KexProposalOption,String> getClientKexProposals()
getKexState()
String getServerVersion()
null
/empty if versions not yet exchangedMap<KexProposalOption,String> getServerKexProposals()
getKexState()
KexState getKexState()
Map<KexProposalOption,String> getKexNegotiationResult()
String getNegotiatedKexParameter(KexProposalOption paramType)
paramType
- The request KexProposalOption
value - ignored if null
null
if invalid parameter or no negotiated value.getKexState()
CipherInformation getCipherInformation(boolean incoming)
incoming
- If true
then the cipher for the incoming data, otherwise for the outgoing dataCipherInformation
- or null
if not negotiated yet.CompressionInformation getCompressionInformation(boolean incoming)
incoming
- If true
then the compression for the incoming data, otherwise for the outgoing dataCompressionInformation
- or null
if not negotiated yet.MacInformation getMacInformation(boolean incoming)
incoming
- If true
then the MAC for the incoming data, otherwise for the outgoing dataMacInformation
- or null
if not negotiated yet.boolean isAuthenticated()
true
if session has successfully completed the authentication phasestatic boolean isValidVersionPrefix(String version)
version
- The reported client/server versiontrue
if version not empty and starts with either "SSH-2.0-" or
"SSH-1.99-"static boolean isSecureSessionTransport(SessionContext session)
session
- The SessionContext
to be examinedtrue
if the context is not null
and the ciphers have been established to anything
other than "none".getNegotiatedKexParameter
,
CIPHER_PROPOSALS
static boolean isDataIntegrityTransport(SessionContext session)
session
- The SessionContext
to be examinedtrue
if the context is not null
and the MAC(s) used to verify packet integrity
have been established.getNegotiatedKexParameter
,
MAC_PROPOSALS
static boolean isValidSessionPayloadSize(long value)
static long validateSessionPayloadSize(long value, String format)
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.