java.lang.Object
org.alfresco.repo.security.authentication.identityservice.UserTokenProviders

public final class UserTokenProviders extends Object
Spring helper that selects the UserTokenProvider implementation to expose to consumers based on the identity-service.authentication.userTokenCache.enabled flag.

Both the direct and the caching providers are constructed by Spring at startup; this helper merely returns one of them. Switching the flag therefore requires only a context reload, not a code change. Consumers receive UserTokenProvider and remain unaware of which implementation backs them.

  • Method Details

    • chooseProvider

      public static UserTokenProvider chooseProvider(boolean cacheEnabled, UserTokenProvider direct, UserTokenProvider caching)
      Parameters:
      cacheEnabled - value of identity-service.authentication.userTokenCache.enabled
      direct - the always-go-to-Keycloak provider
      caching - the local-JVM caching decorator wrapping direct
      Returns:
      caching when the flag is on, otherwise direct