Class PasswordTokenFlow

java.lang.Object
com.sap.cloud.security.xsuaa.tokenflows.PasswordTokenFlow

public class PasswordTokenFlow extends Object
  • Constructor Details

  • Method Details

    • 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 to true.
      Returns:
      this builder.