Interface OAuth2TokenServiceCache

All Known Implementing Classes:
OAuth2TokenServiceCache.Default
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface OAuth2TokenServiceCache
The cache to store instances of OAuth2TokenService according to ClientIdentity.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Default implementation of the interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create an empty cache.
    create(Map<com.sap.cloud.security.config.ClientIdentity,com.sap.cloud.security.xsuaa.client.OAuth2TokenService> cache)
    Create a new cache based on an existing Map instance.
    com.sap.cloud.security.xsuaa.client.OAuth2TokenService
    getTokenService(com.sap.cloud.security.config.ClientIdentity identity)
    Get the token service.
    default void
    Invalidate the cache.
    single(com.sap.cloud.security.xsuaa.client.OAuth2TokenService tokenService)
    Create ab immutable cache instance, with a single entry that is being returned for any provided client identity.
  • Method Details

    • getTokenService

      @Nonnull com.sap.cloud.security.xsuaa.client.OAuth2TokenService getTokenService(@Nullable com.sap.cloud.security.config.ClientIdentity identity)
      Get the token service. Optionally apply client identity secrets to the internal HttpClient.
      Parameters:
      identity - The client identity of a service binding.
      Returns:
      A new or cached instance of OAuth2TokenService.
    • invalidateCache

      default void invalidateCache()
      Invalidate the cache.
    • create

      @Nonnull static OAuth2TokenServiceCache create()
      Create an empty cache.
      Returns:
      A new instance of OAuth2TokenServiceCache.
    • create

      @Nonnull static OAuth2TokenServiceCache create(@Nonnull Map<com.sap.cloud.security.config.ClientIdentity,com.sap.cloud.security.xsuaa.client.OAuth2TokenService> cache)
      Create a new cache based on an existing Map instance. Use this method for testing or customization.
      Parameters:
      cache - Custom data store for the cache.
      Returns:
      A new instance of OAuth2TokenServiceCache.
    • single

      @Nonnull static OAuth2TokenServiceCache single(@Nonnull com.sap.cloud.security.xsuaa.client.OAuth2TokenService tokenService)
      Create ab immutable cache instance, with a single entry that is being returned for any provided client identity. Use this method for testing or for disabling the cache.
      Parameters:
      tokenService - A OAuth2TokenService that will always be returned.
      Returns:
      An immutable instance of OAuth2TokenServiceCache.