Class ServerUserAuthService

    • Field Detail

      • welcomeSent

        private final java.util.concurrent.atomic.AtomicBoolean welcomeSent
      • properties

        private final java.util.Map<java.lang.String,​java.lang.Object> properties
      • 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

      • start

        public void start()
        Specified by:
        start in interface Service
      • 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, 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.

        Specified by:
        getProperties in interface PropertyResolver
        Returns:
        a valid Map containing configuration values, never null. Note: may be immutable.
      • process

        public void process​(int cmd,
                            Buffer buffer)
                     throws java.lang.Exception
        Description copied from interface: Service
        Service the request.
        Specified by:
        process in interface Service
        Parameters:
        cmd - The incoming command type
        buffer - The Buffer containing optional command parameters
        Throws:
        java.lang.Exception - If failed to process the command
      • 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 - The ServerSession 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