Class ServerUserAuthService
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.util.closeable.IoBaseCloseable
-
- org.apache.sshd.common.util.closeable.AbstractCloseable
-
- org.apache.sshd.server.session.ServerUserAuthService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,Closeable
,PropertyResolver
,Service
,SessionContextHolder
,SessionHolder<Session>
,ServerSessionHolder
public class ServerUserAuthService extends AbstractCloseable implements Service, ServerSessionHolder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
-
Field Summary
Fields Modifier and Type Field 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
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
-
Constructor Summary
Constructors Constructor Description ServerUserAuthService(Session s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 invokedvoid
start()
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, doCloseGracefully, doCloseImmediately, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getString, getStringProperty
-
Methods inherited from interface org.apache.sshd.common.Service
getParentPropertyResolver
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
-
-
-
Field Detail
-
welcomeSent
private final java.util.concurrent.atomic.AtomicBoolean welcomeSent
-
properties
private final java.util.Map<java.lang.String,java.lang.Object> properties
-
serverSession
private final ServerSession serverSession
-
welcomePhase
private final WelcomeBannerPhase welcomePhase
-
userAuthFactories
private java.util.List<UserAuthFactory> userAuthFactories
-
authMethods
private java.util.List<java.util.List<java.lang.String>> authMethods
-
authUserName
private java.lang.String authUserName
-
authMethod
private java.lang.String authMethod
-
authService
private java.lang.String authService
-
currentAuth
private UserAuth currentAuth
-
maxAuthRequests
private int maxAuthRequests
-
nbAuthRequests
private int nbAuthRequests
-
-
Constructor Detail
-
ServerUserAuthService
public ServerUserAuthService(Session s) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getWelcomePhase
public WelcomeBannerPhase getWelcomePhase()
-
getSession
public ServerSession getSession()
- Specified by:
getSession
in interfaceSessionHolder<Session>
-
getServerSession
public ServerSession getServerSession()
- Specified by:
getServerSession
in interfaceServerSessionHolder
- Returns:
- The underlying
ServerSession
used
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Description copied from interface: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, thetoString()
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 along
then it will be parsed into one. Also, if the mapped value is anInteger
but along
is expected, then it will be converted into one.- Specified by:
getProperties
in interfacePropertyResolver
- Returns:
- a valid
Map
containing configuration values, nevernull
. Note: may be immutable.
-
process
public void process(int cmd, Buffer buffer) throws java.lang.Exception
Description copied from interface:Service
Service the request.
-
handleUserAuthRequestMessage
protected boolean handleUserAuthRequestMessage(ServerSession session, Buffer buffer, java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> authHolder) throws java.lang.Exception
- Throws:
java.lang.Exception
-
asyncAuth
protected void asyncAuth(int cmd, Buffer buffer, boolean authed)
-
handleAuthenticationInProgress
protected void handleAuthenticationInProgress(int cmd, Buffer buffer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleAuthenticationSuccess
protected void handleAuthenticationSuccess(int cmd, Buffer buffer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
handleAuthenticationFailure
protected void handleAuthenticationFailure(int cmd, Buffer buffer) throws java.lang.Exception
- Throws:
java.lang.Exception
-
sendWelcomeBanner
public IoWriteFuture sendWelcomeBanner(ServerSession session) throws java.io.IOException
Sends the welcome banner (if any configured) and if not already invoked- Parameters:
session
- TheServerSession
to send the welcome banner to- Returns:
- The sent welcome banner
IoWriteFuture
-null
if none sent - Throws:
java.io.IOException
- If failed to send the banner
-
resolveWelcomeBanner
protected java.lang.String resolveWelcomeBanner(ServerSession session) throws java.io.IOException
- Throws:
java.io.IOException
-
loadWelcomeBanner
protected java.lang.String loadWelcomeBanner(ServerSession session, java.net.URL url, java.nio.charset.Charset cs) throws java.io.IOException
- Throws:
java.io.IOException
-
getFactoryManager
public ServerFactoryManager getFactoryManager()
-
-