Class RefreshTokenFlow
- java.lang.Object
-
- com.sap.cloud.security.xsuaa.tokenflows.RefreshTokenFlow
-
public class RefreshTokenFlow extends Object
A refresh token flow builder.
Applications can use this flow exchange a given refresh token for a (refreshed) JWT token.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RefreshTokenFlowdisableCache(boolean disableCache)Can be used to disable the cache for the flow.OAuth2TokenResponseexecute()Executes the refresh token flow against XSUAA.RefreshTokenFlowrefreshToken(String refreshToken)Sets the mandatory refresh token to be exchanged for a (refreshed) JWT.RefreshTokenFlowsubdomain(String subdomain)Sets the subdomain (tenant) the token is requested for.
-
-
-
Method Detail
-
subdomain
public RefreshTokenFlow subdomain(String subdomain)
Sets the subdomain (tenant) the token is requested for.- Parameters:
subdomain- - the subdomain.- Returns:
- this builder.
-
refreshToken
public RefreshTokenFlow refreshToken(String refreshToken)
Sets the mandatory refresh token to be exchanged for a (refreshed) JWT.- Parameters:
refreshToken- - the refresh token to be exchanged for a JWT.- Returns:
- this builder object.
-
disableCache
public RefreshTokenFlow disableCache(boolean disableCache)
Can be used to disable the cache for the flow.- Parameters:
disableCache- - disables cache when set totrue.- Returns:
- this builder.
-
execute
public OAuth2TokenResponse execute() throws IllegalStateException, IllegalArgumentException, TokenFlowException
Executes the refresh token flow against XSUAA.- Returns:
- the refreshed OAuth access token returned by XSUAA or an exception in case the token could not be refreshed.
- Throws:
IllegalStateException- - in case not all mandatory fields of the token flow request have been set.IllegalArgumentException- - in case the refresh token flow request is not valid.TokenFlowException- - in case of an error during the flow, or when the token cannot be refreshed.
-
-