Interface UserAuth

  • All Known Implementing Classes:
    UserAuthImpl

    public interface UserAuth
    User authentication API. See RFC 4252.
    • Method Summary

      Modifier and Type Method Description
      boolean authenticate​(java.lang.String username, Service nextService, AuthMethod methods, int timeoutMs)
      Attempt to authenticate username using each of methods in order.
      java.util.Collection<java.lang.String> getAllowedMethods()
      The available authentication methods.
      java.lang.String getBanner()
      Returns the authentication banner (if any).
      boolean hadPartialSuccess()  
    • Method Detail

      • authenticate

        boolean authenticate​(java.lang.String username,
                             Service nextService,
                             AuthMethod methods,
                             int timeoutMs)
                      throws UserAuthException,
                             TransportException
        Attempt to authenticate username using each of methods in order. nextService is the Service that will be enabled on successful authentication.

        Authentication fails if there are no method available, i.e. if all the method failed or there were method available but could not be attempted because the server did not allow them.

        Further attempts may also be made by catching UserAuthException and retrying with this method.

        Parameters:
        username - the user to authenticate
        nextService - the service to set on successful authentication
        methods - the AuthMethod's to try
        Returns:
        whether authentication was successful
        Throws:
        UserAuthException - in case of authentication failure
        TransportException - if there was a transport-layer error
      • getBanner

        java.lang.String getBanner()
        Returns the authentication banner (if any). In some cases this is available even before the first authentication request has been made.
        Returns:
        the banner, or an empty string if none was received
      • hadPartialSuccess

        boolean hadPartialSuccess()
        Returns:
        whether authentication was partially successful. Some server's may be configured to require multiple authentications; and this value will be true if at least one of the method supplied succeeded.
      • getAllowedMethods

        java.util.Collection<java.lang.String> getAllowedMethods()
        The available authentication methods. This is only defined once an unsuccessful authentication has taken place.