Class PasswordTokenFlow
- java.lang.Object
-
- com.sap.cloud.security.xsuaa.tokenflows.PasswordTokenFlow
-
public class PasswordTokenFlow extends Object
-
-
Constructor Summary
Constructors Constructor Description PasswordTokenFlow(OAuth2TokenService tokenService, OAuth2ServiceEndpointsProvider endpointsProvider, ClientIdentity clientIdentity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PasswordTokenFlowdisableCache(boolean disableCache)Can be used to disable the cache for the flow.OAuth2TokenResponseexecute()Executes this flow against the XSUAA endpoint.PasswordTokenFlowoptionalParameters(Map<String,String> optionalParameters)Adds additional authorization attributes to the request.PasswordTokenFlowpassword(String password)The password for the user trying to get a token.PasswordTokenFlowsubdomain(String subdomain)Set the Subdomain the token is requested for.PasswordTokenFlowusername(String username)The username for the user trying to get a token.
-
-
-
Constructor Detail
-
PasswordTokenFlow
public PasswordTokenFlow(@Nonnull OAuth2TokenService tokenService, @Nonnull OAuth2ServiceEndpointsProvider endpointsProvider, @Nonnull ClientIdentity clientIdentity)
-
-
Method Detail
-
execute
public OAuth2TokenResponse execute() throws TokenFlowException
Executes this flow against the XSUAA endpoint. As a result the exchanged JWT token is returned.- Returns:
- the JWT instance returned by XSUAA.
- Throws:
IllegalStateException- - in case not all mandatory fields of the token flow request have been set.TokenFlowException- - in case of an error during the flow, or when the token cannot be obtained.
-
password
public PasswordTokenFlow password(String password)
The password for the user trying to get a token. This is a required parameter.- Parameters:
password- - the password.- Returns:
- this builder.
-
username
public PasswordTokenFlow username(String username)
The username for the user trying to get a token. This is a required parameter.- Parameters:
username- - the username.- Returns:
- this builder.
-
subdomain
public PasswordTokenFlow subdomain(String subdomain)
Set the Subdomain the token is requested for.- Parameters:
subdomain- - the subdomain.- Returns:
- this builder.
-
optionalParameters
public PasswordTokenFlow optionalParameters(Map<String,String> optionalParameters)
Adds additional authorization attributes to the request.- Parameters:
optionalParameters- - the optional parameters.- Returns:
- this builder.
-
disableCache
public PasswordTokenFlow disableCache(boolean disableCache)
Can be used to disable the cache for the flow.- Parameters:
disableCache- - disables cache when set totrue.- Returns:
- this builder.
-
-