Class CloudCredentials
- java.lang.Object
-
- com.sap.cloudfoundry.client.facade.CloudCredentials
-
public class CloudCredentials extends Object
Class that encapsulates credentials used for authentication
-
-
Constructor Summary
Constructors Constructor Description CloudCredentials(CloudCredentials cloudCredentials, String proxyForUser)Create proxy credentials.CloudCredentials(String email, String password)Create credentials using email and password.CloudCredentials(String email, String password, String clientId)Create credentials using email, password, and client ID.CloudCredentials(String email, String password, String clientId, String clientSecret)Create credentials using email, password and client ID.CloudCredentials(String email, String password, String clientId, String clientSecret, String origin)Create credentials using email, password, client ID and login origin.CloudCredentials(org.springframework.security.oauth2.common.OAuth2AccessToken token)Create credentials using a token.CloudCredentials(org.springframework.security.oauth2.common.OAuth2AccessToken token, boolean refreshable)Create credentials using a token and indicates if the token is refreshable or not.CloudCredentials(org.springframework.security.oauth2.common.OAuth2AccessToken token, String clientId)Create credentials using a token.CloudCredentials(org.springframework.security.oauth2.common.OAuth2AccessToken token, String clientId, String clientSecret)Create credentials using a token.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClientId()Get the client ID.StringgetClientSecret()Get the client secretStringgetEmail()Get the email.StringgetOrigin()Get the originStringgetPassword()Get the password.StringgetProxyUser()Get the proxy user.org.springframework.security.oauth2.common.OAuth2AccessTokengetToken()Get the token.booleanisProxyUserSet()Is this a proxied set of credentials?booleanisRefreshable()Indicates weather the token stored in the cloud credentials can be refreshed or not.CloudCredentialsproxyForUser(String user)Run commands as a different user.
-
-
-
Constructor Detail
-
CloudCredentials
public CloudCredentials(String email, String password)
Create credentials using email and password.- Parameters:
email- email to authenticate withpassword- the password
-
CloudCredentials
public CloudCredentials(String email, String password, String clientId)
Create credentials using email, password, and client ID.- Parameters:
email- email to authenticate withpassword- the passwordclientId- 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 withpassword- the passwordclientId- the client ID to use for authorizationclientSecret- 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 withpassword- the passwordclientId- the client ID to use for authorizationclientSecret- the secret for the given clientorigin- 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 authorizationrefreshable- 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 authorizationclientId- 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 authorizationclientId- the client ID to use for authorizationclientSecret- the password for the specified client
-
CloudCredentials
public CloudCredentials(CloudCredentials cloudCredentials, String proxyForUser)
Create proxy credentials.- Parameters:
cloudCredentials- credentials to useproxyForUser- 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
-
-