public class ServerUserAuthService extends AbstractCloseable implements Service, ServerSessionHolder
AbstractCloseable.State
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
authMethod |
private java.util.List<java.util.List<java.lang.String>> |
authMethods |
private java.lang.String |
authService |
private java.lang.String |
authUserName |
private UserAuth |
currentAuth |
private int |
maxAuthRequests |
private int |
nbAuthRequests |
private java.util.Map<java.lang.String,java.lang.Object> |
properties |
private ServerSession |
serverSession |
private java.util.List<UserAuthFactory> |
userAuthFactories |
private WelcomeBannerPhase |
welcomePhase |
private java.util.concurrent.atomic.AtomicBoolean |
welcomeSent |
closeFuture, futureLock, state
log
EMPTY
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
Constructor and Description |
---|
ServerUserAuthService(Session s) |
Modifier and Type | Method and Description |
---|---|
protected void |
asyncAuth(int cmd,
Buffer buffer,
boolean authed) |
ServerFactoryManager |
getFactoryManager() |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
A map of properties that can be used to configure the SSH server or client.
|
ServerSession |
getServerSession() |
ServerSession |
getSession() |
WelcomeBannerPhase |
getWelcomePhase() |
protected void |
handleAuthenticationFailure(int cmd,
Buffer buffer) |
protected void |
handleAuthenticationInProgress(int cmd,
Buffer buffer) |
protected void |
handleAuthenticationSuccess(int cmd,
Buffer buffer) |
protected boolean |
handleUserAuthRequestMessage(ServerSession session,
Buffer buffer,
java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> authHolder) |
protected java.lang.String |
loadWelcomeBanner(ServerSession session,
java.net.URL url,
java.nio.charset.Charset cs) |
void |
process(int cmd,
Buffer buffer)
Service the request.
|
protected java.lang.String |
resolveWelcomeBanner(ServerSession session) |
IoWriteFuture |
sendWelcomeBanner(ServerSession session)
Sends the welcome banner (if any configured) and if not already invoked
|
void |
start() |
addCloseFutureListener, builder, close, doCloseGracefully, doCloseImmediately, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParentPropertyResolver
getSessionContext
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getString, getStringProperty
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
private final java.util.concurrent.atomic.AtomicBoolean welcomeSent
private final java.util.Map<java.lang.String,java.lang.Object> properties
private final ServerSession serverSession
private final WelcomeBannerPhase welcomePhase
private java.util.List<UserAuthFactory> userAuthFactories
private java.util.List<java.util.List<java.lang.String>> authMethods
private java.lang.String authUserName
private java.lang.String authMethod
private java.lang.String authService
private UserAuth currentAuth
private int maxAuthRequests
private int nbAuthRequests
public ServerUserAuthService(Session s) throws java.io.IOException
java.io.IOException
public WelcomeBannerPhase getWelcomePhase()
public ServerSession getSession()
getSession
in interface SessionHolder<Session>
public ServerSession getServerSession()
getServerSession
in interface ServerSessionHolder
ServerSession
usedpublic java.util.Map<java.lang.String,java.lang.Object> getProperties()
PropertyResolver
A map of properties that can be used to configure the SSH server or client. This map will never be changed by either the server or client and is not supposed to be changed at runtime (changes are not bound to have any effect on a running client or server), though it may affect the creation of sessions later as these values are usually not cached.
Note: the type of the mapped property should match the expected configuration value type -
Long, Integer, Boolean,
String
, etc.... If it doesn't, the toString()
result of the mapped value is used to convert it to the
required type. E.g., if the mapped value is the string "1234" and the expected value is a
long
then it will be parsed into one. Also, if the mapped value is an Integer
but a long
is expected, then it will be converted into one.
getProperties
in interface PropertyResolver
Map
containing configuration values, never null
. Note: may be
immutable.public void process(int cmd, Buffer buffer) throws java.lang.Exception
Service
protected boolean handleUserAuthRequestMessage(ServerSession session, Buffer buffer, java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> authHolder) throws java.lang.Exception
java.lang.Exception
protected void asyncAuth(int cmd, Buffer buffer, boolean authed)
protected void handleAuthenticationInProgress(int cmd, Buffer buffer) throws java.lang.Exception
java.lang.Exception
protected void handleAuthenticationSuccess(int cmd, Buffer buffer) throws java.lang.Exception
java.lang.Exception
protected void handleAuthenticationFailure(int cmd, Buffer buffer) throws java.lang.Exception
java.lang.Exception
public IoWriteFuture sendWelcomeBanner(ServerSession session) throws java.io.IOException
session
- The ServerSession
to send the welcome banner toIoWriteFuture
- null
if none sentjava.io.IOException
- If failed to send the bannerprotected java.lang.String resolveWelcomeBanner(ServerSession session) throws java.io.IOException
java.io.IOException
protected java.lang.String loadWelcomeBanner(ServerSession session, java.net.URL url, java.nio.charset.Charset cs) throws java.io.IOException
java.io.IOException
public ServerFactoryManager getFactoryManager()