Class CloudCredentials


  • public class CloudCredentials
    extends Object
    Class that encapsulates credentials used for authentication
    • Constructor Detail

      • CloudCredentials

        public CloudCredentials​(String email,
                                String password)
        Create credentials using email and password.
        Parameters:
        email - email to authenticate with
        password - the password
      • CloudCredentials

        public CloudCredentials​(String email,
                                String password,
                                String clientId)
        Create credentials using email, password, and client ID.
        Parameters:
        email - email to authenticate with
        password - the password
        clientId - the client ID to use for authorization
      • CloudCredentials

        public CloudCredentials​(String email,
                                String password,
                                String clientId,
                                String clientSecret)
        Create credentials using email, password and client ID.
        Parameters:
        email - email to authenticate with
        password - the password
        clientId - the client ID to use for authorization
        clientSecret - the secret for the given client
      • CloudCredentials

        public CloudCredentials​(String email,
                                String password,
                                String clientId,
                                String clientSecret,
                                String origin)
        Create credentials using email, password, client ID and login origin.
        Parameters:
        email - email to authenticate with
        password - the password
        clientId - the client ID to use for authorization
        clientSecret - the secret for the given client
        origin - the origin name
      • CloudCredentials

        public CloudCredentials​(org.springframework.security.oauth2.common.OAuth2AccessToken token)
        Create credentials using a token.
        Parameters:
        token - token to use for authorization
      • CloudCredentials

        public CloudCredentials​(org.springframework.security.oauth2.common.OAuth2AccessToken token,
                                boolean refreshable)
        Create credentials using a token and indicates if the token is refreshable or not.
        Parameters:
        token - token to use for authorization
        refreshable - indicates if the token can be refreshed or not
      • CloudCredentials

        public CloudCredentials​(org.springframework.security.oauth2.common.OAuth2AccessToken token,
                                String clientId)
        Create credentials using a token.
        Parameters:
        token - token to use for authorization
        clientId - the client ID to use for authorization
      • CloudCredentials

        public CloudCredentials​(org.springframework.security.oauth2.common.OAuth2AccessToken token,
                                String clientId,
                                String clientSecret)
        Create credentials using a token.
        Parameters:
        token - token to use for authorization
        clientId - the client ID to use for authorization
        clientSecret - the password for the specified client
      • CloudCredentials

        public CloudCredentials​(CloudCredentials cloudCredentials,
                                String proxyForUser)
        Create proxy credentials.
        Parameters:
        cloudCredentials - credentials to use
        proxyForUser - user to be proxied
    • Method Detail

      • getClientId

        public String getClientId()
        Get the client ID.
        Returns:
        the client ID
      • getClientSecret

        public String getClientSecret()
        Get the client secret
        Returns:
        the client secret
      • getOrigin

        public String getOrigin()
        Get the origin
        Returns:
        the origin
      • getEmail

        public String getEmail()
        Get the email.
        Returns:
        the email
      • getPassword

        public String getPassword()
        Get the password.
        Returns:
        the password
      • getProxyUser

        public String getProxyUser()
        Get the proxy user.
        Returns:
        the proxy user
      • getToken

        public org.springframework.security.oauth2.common.OAuth2AccessToken getToken()
        Get the token.
        Returns:
        the token
      • isProxyUserSet

        public boolean isProxyUserSet()
        Is this a proxied set of credentials?
        Returns:
        whether a proxy user is set
      • isRefreshable

        public boolean isRefreshable()
        Indicates weather the token stored in the cloud credentials can be refreshed or not. This is useful when the token stored in this object was obtained via implicit OAuth2 authentication and therefore can not be refreshed.
        Returns:
        weather the token can be refreshed
      • proxyForUser

        public CloudCredentials proxyForUser​(String user)
        Run commands as a different user. The authenticated user must be privileged to run as this user.
        Parameters:
        user - the user to proxy for
        Returns:
        credentials for the proxied user