Class Credentials

  • All Implemented Interfaces:
    Serializable

    public class Credentials
    extends Object
    implements Serializable
    Simple arbitrary set of credentials, including a username/password pair, the HttpServletRequest associated with the request for authorization (if any) and the HttpSession associated with that request. This class is used along with AuthenticationProvider to provide arbitrary HTTP-based authentication for Guacamole.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Credentials​(String username, String password, javax.servlet.http.HttpServletRequest request)
      Construct a Credentials object with the given username, password, and HTTP request.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getPassword()
      Returns the password associated with this set of credentials.
      String getRemoteAddress()
      Returns the address of the client end of the connection which provided these credentials, if known.
      String getRemoteHostname()
      Returns the hostname of the client end of the connection which provided these credentials, if known.
      javax.servlet.http.HttpServletRequest getRequest()
      Returns the HttpServletRequest associated with this set of credentials.
      javax.servlet.http.HttpSession getSession()
      Returns the HttpSession associated with this set of credentials.
      String getUsername()
      Returns the username associated with this set of credentials.
      void setPassword​(String password)
      Sets the password associated with this set of credentials.
      void setRemoteAddress​(String remoteAddress)
      Sets the address of the client end of the connection which provided these credentials.
      void setRemoteHostname​(String remoteHostname)
      Sets the hostname of the client end of the connection which provided these credentials, if known.
      void setRequest​(javax.servlet.http.HttpServletRequest request)
      Sets the HttpServletRequest associated with this set of credentials.
      void setSession​(javax.servlet.http.HttpSession session)
      Sets the HttpSession associated with this set of credentials.
      void setUsername​(String username)
      Sets the username associated with this set of credentials.
    • Constructor Detail

      • Credentials

        public Credentials​(String username,
                           String password,
                           javax.servlet.http.HttpServletRequest request)
        Construct a Credentials object with the given username, password, and HTTP request. The information is assigned to the various storage objects, and the remote hostname and address is parsed out of the request object.
        Parameters:
        username - The username that was provided for authentication.
        password - The password that was provided for authentication.
        request - The HTTP request associated with the authentication request.
    • Method Detail

      • getPassword

        public String getPassword()
        Returns the password associated with this set of credentials.
        Returns:
        The password associated with this username/password pair, or null if no password has been set.
      • setPassword

        public void setPassword​(String password)
        Sets the password associated with this set of credentials.
        Parameters:
        password - The password to associate with this username/password pair.
      • getUsername

        public String getUsername()
        Returns the username associated with this set of credentials.
        Returns:
        The username associated with this username/password pair, or null if no username has been set.
      • setUsername

        public void setUsername​(String username)
        Sets the username associated with this set of credentials.
        Parameters:
        username - The username to associate with this username/password pair.
      • getRequest

        public javax.servlet.http.HttpServletRequest getRequest()
        Returns the HttpServletRequest associated with this set of credentials.
        Returns:
        The HttpServletRequest associated with this set of credentials, or null if no such request exists.
      • setRequest

        public void setRequest​(javax.servlet.http.HttpServletRequest request)
        Sets the HttpServletRequest associated with this set of credentials.
        Parameters:
        request - The HttpServletRequest to associated with this set of credentials.
      • getSession

        public javax.servlet.http.HttpSession getSession()
        Returns the HttpSession associated with this set of credentials.
        Returns:
        The HttpSession associated with this set of credentials, or null if no such request exists.
      • setSession

        public void setSession​(javax.servlet.http.HttpSession session)
        Sets the HttpSession associated with this set of credentials.
        Parameters:
        session - The HttpSession to associated with this set of credentials.
      • getRemoteAddress

        public String getRemoteAddress()
        Returns the address of the client end of the connection which provided these credentials, if known.
        Returns:
        The address of the client end of the connection which provided these credentials, or null if the address is not known.
      • setRemoteAddress

        public void setRemoteAddress​(String remoteAddress)
        Sets the address of the client end of the connection which provided these credentials.
        Parameters:
        remoteAddress - The address of the client end of the connection which provided these credentials, or null if the address is not known.
      • getRemoteHostname

        public String getRemoteHostname()
        Returns the hostname of the client end of the connection which provided these credentials, if known. If the hostname of the client cannot be determined, but the address is known, the address may be returned instead.
        Returns:
        The hostname or address of the client end of the connection which provided these credentials, or null if the hostname is not known.
      • setRemoteHostname

        public void setRemoteHostname​(String remoteHostname)
        Sets the hostname of the client end of the connection which provided these credentials, if known. If the hostname of the client cannot be determined, but the address is known, the address may be specified instead.
        Parameters:
        remoteHostname - The hostname or address of the client end of the connection which provided these credentials, or null if the hostname is not known.