org.springframework.security.oauth2.client.OAuth2RestTemplate.setInterceptors()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.springframework.security.oauth2.client.OAuth2RestTemplate.setInterceptors()方法的一些代码示例,展示了OAuth2RestTemplate.setInterceptors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OAuth2RestTemplate.setInterceptors()方法的具体详情如下:
包路径:org.springframework.security.oauth2.client.OAuth2RestTemplate
类名称:OAuth2RestTemplate
方法名:setInterceptors

OAuth2RestTemplate.setInterceptors介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-security-oauth

@BeforeOAuth2Context
public void fixPaths() {
  init();
  BaseOAuth2ProtectedResourceDetails resource = (BaseOAuth2ProtectedResourceDetails) context.getResource();
  List<HttpMessageConverter<?>> converters = new ArrayList<>(context.getRestTemplate().getMessageConverters());
  converters.addAll(getAdditionalConverters());
  context.getRestTemplate().setMessageConverters(converters);
  context.getRestTemplate().setInterceptors(getInterceptors());
  resource.setAccessTokenUri(http.getUrl(tokenPath()));
  if (resource instanceof AbstractRedirectResourceDetails) {
    ((AbstractRedirectResourceDetails) resource).setUserAuthorizationUri(http.getUrl(authorizePath()));
  }
  if (resource instanceof ImplicitResourceDetails) {
    resource.setAccessTokenUri(http.getUrl(authorizePath()));
  }
  if (resource instanceof ResourceOwnerPasswordResourceDetails && !(resource instanceof DoNotOverride)) {
    ((ResourceOwnerPasswordResourceDetails) resource).setUsername(getUsername());
    ((ResourceOwnerPasswordResourceDetails) resource).setPassword(getPassword());
  }
}

代码示例来源:origin: spring-cloud/spring-cloud-security

@Override
    public void customize(OAuth2RestTemplate restTemplate) {
        List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
                restTemplate.getInterceptors());
        interceptors.add(loadBalancerInterceptor);
        restTemplate.setInterceptors(interceptors);
    }
};

代码示例来源:origin: junneyang/xxproject

@Bean
  public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer(
      TraceRestTemplateInterceptor traceRestTemplateInterceptor) {
    return restTemplate -> {
      List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
          restTemplate.getInterceptors());
      interceptors.add(traceRestTemplateInterceptor);
      restTemplate.setInterceptors(interceptors);
    };
  }
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-security

@Override
  public void customize(OAuth2RestTemplate restTemplate) {
    List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
        restTemplate.getInterceptors());
    interceptors.add(loadBalancerInterceptor);
    restTemplate.setInterceptors(interceptors);
  }
};

代码示例来源:origin: spring-cloud/spring-cloud-security

@Override
  public void customize(OAuth2RestTemplate restTemplate) {
    List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
        restTemplate.getInterceptors());
    interceptors.add(loadBalancerInterceptor);
    restTemplate.setInterceptors(interceptors);
  }
};

代码示例来源:origin: junneyang/xxproject

@Bean
public UserInfoRestTemplateCustomizer userInfoRestTemplateCustomizer(
    TraceRestTemplateInterceptor traceRestTemplateInterceptor) {
  return restTemplate -> {
    List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
        restTemplate.getInterceptors());
    interceptors.add(traceRestTemplateInterceptor);
    restTemplate.setInterceptors(interceptors);
  };
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-security

@Override
    public void customize(OAuth2RestTemplate restTemplate) {
        List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>(
                restTemplate.getInterceptors());
        interceptors.add(loadBalancerInterceptor);
        restTemplate.setInterceptors(interceptors);
    }
};

相关文章