Class OAuth2ConfigDataLocationResolver

java.lang.Object
io.pivotal.spring.cloud.config.client.OAuth2ConfigDataLocationResolver
All Implemented Interfaces:
org.springframework.boot.context.config.ConfigDataLocationResolver<org.springframework.cloud.config.client.ConfigServerConfigDataResource>, Ordered

public class OAuth2ConfigDataLocationResolver extends Object implements org.springframework.boot.context.config.ConfigDataLocationResolver<org.springframework.cloud.config.client.ConfigServerConfigDataResource>, Ordered
Using oauth2 properties to configure an authorization interceptor for the RestTemplate that calls config server.

Note: Despite implementing ConfigDataLocationResolver, this class does not resolve any location. It only configures and registers the ConfigClientRequestTemplateFactory which later will be used by ConfigServerConfigDataLocationResolver to create RestTemplate for calling config server.

Finally, it registers the RestTemplate bean to be consumed by ConfigResourceClientAutoConfiguration and VaultTokenRenewalAutoConfiguration after application startup.

  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    OAuth2ConfigDataLocationResolver(org.springframework.boot.logging.DeferredLogFactory factory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    It should be registered before ConfigServerConfigDataLocationResolver.
    boolean
    isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext resolverContext, org.springframework.boot.context.config.ConfigDataLocation location)
     
    List<org.springframework.cloud.config.client.ConfigServerConfigDataResource>
    resolve(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location)
     
    List<org.springframework.cloud.config.client.ConfigServerConfigDataResource>
    resolveProfileSpecific(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location, org.springframework.boot.context.config.Profiles profiles)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OAuth2ConfigDataLocationResolver

      public OAuth2ConfigDataLocationResolver(org.springframework.boot.logging.DeferredLogFactory factory)
  • Method Details

    • isResolvable

      public boolean isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext resolverContext, org.springframework.boot.context.config.ConfigDataLocation location)
      Specified by:
      isResolvable in interface org.springframework.boot.context.config.ConfigDataLocationResolver<org.springframework.cloud.config.client.ConfigServerConfigDataResource>
    • resolve

      public List<org.springframework.cloud.config.client.ConfigServerConfigDataResource> resolve(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location) throws org.springframework.boot.context.config.ConfigDataLocationNotFoundException, org.springframework.boot.context.config.ConfigDataResourceNotFoundException
      Specified by:
      resolve in interface org.springframework.boot.context.config.ConfigDataLocationResolver<org.springframework.cloud.config.client.ConfigServerConfigDataResource>
      Throws:
      org.springframework.boot.context.config.ConfigDataLocationNotFoundException
      org.springframework.boot.context.config.ConfigDataResourceNotFoundException
    • resolveProfileSpecific

      public List<org.springframework.cloud.config.client.ConfigServerConfigDataResource> resolveProfileSpecific(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location, org.springframework.boot.context.config.Profiles profiles) throws org.springframework.boot.context.config.ConfigDataLocationNotFoundException
      Specified by:
      resolveProfileSpecific in interface org.springframework.boot.context.config.ConfigDataLocationResolver<org.springframework.cloud.config.client.ConfigServerConfigDataResource>
      Throws:
      org.springframework.boot.context.config.ConfigDataLocationNotFoundException
    • getOrder

      public int getOrder()
      It should be registered before ConfigServerConfigDataLocationResolver. See ConfigServerConfigDataLocationResolver.getOrder()
      Specified by:
      getOrder in interface Ordered