Class XsuaaTokenFlows

  • All Implemented Interfaces:
    Serializable

    public class XsuaaTokenFlows
    extends Object
    implements Serializable
    A bean that can be @Autowired by applications to get access to token flow builders. The token flow builders allow for the execution of a client credentials flow (to get a technical user token) and a user token flow (to get an exchange token with different scopes).
    This class uses a RestTemplate which it passes on to the builders.
    See Also:
    Serialized Form
    • Constructor Detail

      • XsuaaTokenFlows

        public XsuaaTokenFlows​(OAuth2TokenService oAuth2TokenService,
                               OAuth2ServiceEndpointsProvider endpointsProvider,
                               ClientIdentity clientIdentity)
        Create a new instance of this bean with the given RestTemplate. Applications should @Autowire instances of this bean.
        Parameters:
        oAuth2TokenService - the OAuth2TokenService that will be used to send the token exchange request.
        endpointsProvider - the endpoint provider that serves the token endpoint.
        clientIdentity - the OAuth2.0 client identity
                    
         String clientId     = "<<get your client id from your service binding>>";
         String clientSecret = "<<get your client secret from your service binding>>";
         String xsuaaBaseUrl = "<<get your xsuaa base url from service binding>>";
        
         XsuaaTokenFlows tokenFlows = new XsuaaTokenFlows(
                                   new DefaultOAuth2TokenService(),
                                   new XsuaaDefaultEndpoints(xsuaaBaseUrl),
                                   new ClientCredentials(clientId, clientSecret));
         
                    
    • Method Detail

      • userTokenFlow

        public UserTokenFlow userTokenFlow()
        Creates a new User Token Flow builder object. Token, authorize and key set endpoints will be derived relative to the base URI.
        Returns:
        the UserTokenFlow builder object.
      • clientCredentialsTokenFlow

        public ClientCredentialsTokenFlow clientCredentialsTokenFlow()
        Creates a new Client Credentials Flow builder object.
        Token, authorize and key set endpoints will be derived relative to the base URI.
        Returns:
        the ClientCredentialsTokenFlow builder object.
      • refreshTokenFlow

        public RefreshTokenFlow refreshTokenFlow()
        Creates a new Refresh Token Flow builder object.
        Token, authorize and key set endpoints will be derived relative to the base URI.
        Returns:
        the RefreshTokenFlow builder object.
      • passwordTokenFlow

        public PasswordTokenFlow passwordTokenFlow()
        Creates a new Refresh Token Flow builder object.
        Token, authorize and key set endpoints will be derived relative to the base URI.
        Returns:
        the PasswordTokenFlow builder object.