• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UserInfoTokenServices类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices的典型用法代码示例。如果您正苦于以下问题:Java UserInfoTokenServices类的具体用法?Java UserInfoTokenServices怎么用?Java UserInfoTokenServices使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UserInfoTokenServices类属于org.springframework.boot.autoconfigure.security.oauth2.resource包,在下文中一共展示了UserInfoTokenServices类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: general

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
public static Filter general(AuthorizationCodeResourceDetails client, ResourceServerProperties resourceServerProperties, String path, OAuth2ClientContext oauth2ClientContext) {
	OAuth2ClientAuthenticationProcessingFilter oAuth2ClientAuthenticationFilter = new OAuth2ClientAuthenticationProcessingFilter(path){
		protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
		                                        FilterChain chain, Authentication authResult) throws IOException, ServletException {
			super.successfulAuthentication(request, response, chain, authResult);
			OAuth2AccessToken accessToken = restTemplate.getAccessToken();
			log.warn(new Gson().toJson(authResult));
			log.warn(new Gson().toJson(accessToken));
		}
	};
	OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(client, oauth2ClientContext);
	oAuth2ClientAuthenticationFilter.setRestTemplate(oAuth2RestTemplate);
	UserInfoTokenServices tokenServices = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), client.getClientId());
	tokenServices.setRestTemplate(oAuth2RestTemplate);
	oAuth2ClientAuthenticationFilter.setTokenServices(tokenServices);
	return oAuth2ClientAuthenticationFilter;
}
 
开发者ID:DataAgg,项目名称:DAFramework,代码行数:18,代码来源:OAuth2Util.java


示例2: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter() {
    CompositeFilter filter = new CompositeFilter();
    List<Filter> filters = new ArrayList<>();

    OAuth2ClientAuthenticationProcessingFilter facebookFilter = new OAuth2ClientAuthenticationProcessingFilter("/login/facebook");
    OAuth2RestTemplate facebookTemplate = new OAuth2RestTemplate(facebook(), oAuth2ClientContext);
    facebookFilter.setRestTemplate(facebookTemplate);
    facebookFilter.setTokenServices(new UserInfoTokenServices(facebookResource().getUserInfoUri(), facebook().getClientId()));
    filters.add(facebookFilter);

    OAuth2ClientAuthenticationProcessingFilter googleFilter = new OAuth2ClientAuthenticationProcessingFilter("/login/google");
    OAuth2RestTemplate googleTemplate = new OAuth2RestTemplate(google(), oAuth2ClientContext);
    googleFilter.setRestTemplate(googleTemplate);
    googleFilter.setTokenServices(new UserInfoTokenServices(googleResource().getUserInfoUri(), google().getClientId()));
    filters.add(googleFilter);

    filter.setFilters(filters);
    return filter;
}
 
开发者ID:scionaltera,项目名称:emergentmud,代码行数:20,代码来源:SecurityConfiguration.java


示例3: wechat

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
public static Filter wechat(AuthorizationCodeResourceDetails client, ResourceServerProperties resourceServerProperties, String path, OAuth2ClientContext oauth2ClientContext) {
	OAuth2ClientAuthenticationProcessingFilter oAuth2ClientAuthenticationFilter = new OAuth2ClientAuthenticationProcessingFilter(path);

	OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(client, oauth2ClientContext);
	AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider();
	accessTokenProvider.setAuthorizationRequestEnhancer((request, resource, form, headers) -> {
		form.set("appid", resource.getClientId());
		form.set("secret", resource.getClientSecret());
		form.set("scope", "snsapi_userinfo");
		form.set("response_type", "code");
		form.set("#wechat_redirect", "");
	});
	accessTokenProvider.setMessageConverters(converters());
	oAuth2RestTemplate.setAccessTokenProvider(accessTokenProvider);

	oAuth2RestTemplate.setRetryBadAccessTokens(true);
	oAuth2ClientAuthenticationFilter.setRestTemplate(oAuth2RestTemplate);

	UserInfoTokenServices tokenServices = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), client.getClientId());
	tokenServices.setRestTemplate(oAuth2RestTemplate);
	oAuth2ClientAuthenticationFilter.setTokenServices(tokenServices);
	return oAuth2ClientAuthenticationFilter;
}
 
开发者ID:DataAgg,项目名称:DAFramework,代码行数:24,代码来源:OAuth2Util.java


示例4: clientConfigured

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
@Test
public void clientConfigured() throws Exception {
	this.context = new SpringApplicationBuilder(ClientConfiguration.class)
			.properties("spring.config.name=test", "server.port=0",
					"security.oauth2.resource.userInfoUri:http://example.com",
					"security.oauth2.client.clientId=foo")
			.run();
	RequestContextHolder.setRequestAttributes(
			new ServletRequestAttributes(new MockHttpServletRequest()));
	OAuth2ClientContext client = this.context.getBean(OAuth2ClientContext.class);
	assertNull(client.getAccessToken());
	UserInfoTokenServices services = context.getBean(UserInfoTokenServices.class);
	OAuth2RestTemplate template = (OAuth2RestTemplate) ReflectionTestUtils
			.getField(services, "restTemplate");
	MockRestServiceServer server = MockRestServiceServer.createServer(template);
	server.expect(requestTo("http://example.com"))
			.andRespond(withSuccess("{\"id\":\"user\"}", MediaType.APPLICATION_JSON));
	services.loadAuthentication("FOO");
	assertEquals("FOO", client.getAccessToken().getValue());
	server.verify();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-security,代码行数:22,代码来源:ResourceServerTokenRelayAutoConfigurationTests.java


示例5: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter() {
    OAuth2ClientAuthenticationProcessingFilter facebookFilter = new OAuth2ClientAuthenticationProcessingFilter("/login");
    OAuth2RestTemplate facebookTemplate = new OAuth2RestTemplate(facebook(), oauth2ClientContext);
    facebookFilter.setRestTemplate(facebookTemplate);
    UserInfoTokenServices tokenServices = new UserInfoTokenServices(facebookResource().getUserInfoUri(), facebook().getClientId());
    tokenServices.setRestTemplate(facebookTemplate);
    facebookFilter.setTokenServices(tokenServices);
    SavedRequestAwareAuthenticationSuccessHandler authenticationSuccessHandler = new SavedRequestAwareAuthenticationSuccessHandler();
    authenticationSuccessHandler.setUseReferer(true);
    authenticationSuccessHandler.setTargetUrlParameter("continue");
    facebookFilter.setAuthenticationSuccessHandler(authenticationSuccessHandler);
    return facebookFilter;
}
 
开发者ID:Microsoft,项目名称:movie-db-java-on-azure,代码行数:14,代码来源:SecurityConfig.java


示例6: detect

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
@Override
public Set<Relationship> detect() {
    if (tokenService instanceof RemoteTokenServices || tokenService instanceof UserInfoTokenServices) {
        return Dependency.on(Component.of(getDefaultName(), ComponentType.HTTP_APPLICATION)).asRelationshipSet();
    }
    return Collections.emptySet();
}
 
开发者ID:cereebro,项目名称:cereebro,代码行数:8,代码来源:AuthorizationServerRelationshipDetector.java


示例7: usingUserInfoTokenServicesShouldReturnDependency

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
@Test
public void usingUserInfoTokenServicesShouldReturnDependency() {
    ResourceServerTokenServices tokenService = new UserInfoTokenServices("/info", "nope");
    detector = new AuthorizationServerRelationshipDetector(tokenService);
    Set<Relationship> expected = new HashSet<>(Arrays
            .asList(Dependency.on(Component.of("oauth2-authorization-server", ComponentType.HTTP_APPLICATION))));
    Set<Relationship> result = detector.detect();
    Assertions.assertThat(result).isEqualTo(expected);
}
 
开发者ID:cereebro,项目名称:cereebro,代码行数:10,代码来源:AuthorizationServerRelationshipDetectorTest.java


示例8: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter() {
    OAuth2ClientAuthenticationProcessingFilter facebookFilter = new OAuth2ClientAuthenticationProcessingFilter(
            "/login/facebook");
    OAuth2RestTemplate facebookTemplate = new OAuth2RestTemplate(facebook(), oauth2ClientContext);
    facebookFilter.setRestTemplate(facebookTemplate);
    UserInfoTokenServices tokenServices = new UserInfoTokenServices(facebookResource().getUserInfoUri(),
            facebook().getClientId());
    tokenServices.setRestTemplate(facebookTemplate);
    facebookFilter.setTokenServices(
            new UserInfoTokenServices(facebookResource().getUserInfoUri(), facebook().getClientId()));
    return facebookFilter;
}
 
开发者ID:arityllc,项目名称:referenceapp,代码行数:13,代码来源:OAuthService.java


示例9: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private OAuth2ClientAuthenticationProcessingFilter ssoFilter(String provideName,
                                                             ClientResources clientResources) {
    OAuth2ClientAuthenticationProcessingFilter filter =
            new OAuth2ClientAuthenticationProcessingFilter(format("/login/%s", provideName));
    filter.setRestTemplate(new OAuth2RestTemplate(clientResources.getClient(), oauth2ClientContext));
    filter.setTokenServices(new UserInfoTokenServices(clientResources.getResource().getUserInfoUri(),
            clientResources.getClient().getClientId()));
    filter.setApplicationEventPublisher(applicationEventPublisher);
    return filter;
}
 
开发者ID:restbucks,项目名称:restbucks-member,代码行数:11,代码来源:WebSecurityConfiguration.java


示例10: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter(ClientResources client, String path) {
    OAuth2ClientAuthenticationProcessingFilter filter
            = new OAuth2ClientAuthenticationProcessingFilter(path);
    OAuth2RestTemplate template = new OAuth2RestTemplate(client.getClient(), oauth2ClientContext);
    filter.setRestTemplate(template);
    filter.setTokenServices(new UserInfoTokenServices(client.getResource().getUserInfoUri(), client.getClient().getClientId()));
    return filter;
}
 
开发者ID:adarshkumarsingh83,项目名称:spring_boot,代码行数:9,代码来源:ApplicationConfiguration.java


示例11: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter()
{
  OAuth2ClientAuthenticationProcessingFilter eveFilter = new OAuth2ClientAuthenticationProcessingFilter("/login/eve");
  OAuth2RestTemplate eveTemplate = new OAuth2RestTemplate(eve(), oauth2ClientContext);
  eveFilter.setRestTemplate(eveTemplate);
  eveFilter.setTokenServices(new UserInfoTokenServices(eveResource().getUserInfoUri(), eve().getClientId()));
  return eveFilter;
}
 
开发者ID:fetox74,项目名称:eve-oauth2-example,代码行数:9,代码来源:EveOAuth2Example.java


示例12: customSSOFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
/**
 * ## todo : describe.
 *
 * @param client     {@link ClientResources}
 * @param processUrl {@link String}
 * @return {@link Filter}
 */
private Filter customSSOFilter(final ClientResources client, final String processUrl) {
	final OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(processUrl);

	final OAuth2RestTemplate template = new OAuth2RestTemplate(client.getClient(), oauth2ClientContext);
	filter.setRestTemplate(template);

	final UserInfoTokenServices tokenServices = new UserInfoTokenServices(client.getResource().getUserInfoUri(), client.getClient().getClientId());
	tokenServices.setRestTemplate(template);
	filter.setTokenServices(tokenServices);

	return filter;
}
 
开发者ID:inspectIT,项目名称:marketplace,代码行数:20,代码来源:WebSecurityConfig.java


示例13: CustomOAuthAuthenticationProcessingFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
public CustomOAuthAuthenticationProcessingFilter(String path, ClientResourceDetails clientResourceDetails, MappingJackson2HttpMessageConverter jsonMessageConverter) {
    super(path);
    this.clientResourceDetails = clientResourceDetails;
    this.tokenService = new UserInfoTokenServices(clientResourceDetails.getResource().getUserInfoUri(), clientResourceDetails.getClient().getClientId());
    this.accessTokenProvider.setStateMandatory(false);
    this.jsonMessageConverter = jsonMessageConverter;
}
 
开发者ID:HelfenKannJeder,项目名称:come2help,代码行数:8,代码来源:CustomOAuthAuthenticationProcessingFilter.java


示例14: createSsoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private OAuth2ClientAuthenticationProcessingFilter createSsoFilter(ClientResourceDetails clientDetails, AuthenticationSuccessHandler successHandler, String path) {
    OAuth2ClientAuthenticationProcessingFilter ssoFilter = new OAuth2ClientAuthenticationProcessingFilter(path);
    ssoFilter.setAllowSessionCreation(false);
    OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(clientDetails.getClient(), oAuth2ClientContext);
    ssoFilter.setRestTemplate(restTemplate);
    ssoFilter.setTokenServices(new UserInfoTokenServices(clientDetails.getResource().getUserInfoUri(), clientDetails.getClient().getClientId()));
    ssoFilter.setAuthenticationSuccessHandler(successHandler);
    return ssoFilter;
}
 
开发者ID:andreas-eberle,项目名称:spring-oauth2-jwt-minimal,代码行数:10,代码来源:OAuth2ClientConfigurer.java


示例15: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter(ClientResources client, String path) {
    OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(path);
    OAuth2RestTemplate template = new OAuth2RestTemplate(client.getClient(), oauth2ClientContext);
    filter.setRestTemplate(template);
    UserInfoTokenServices tokenServices =
        new UserInfoTokenServices(client.getResource().getUserInfoUri(), client.getClient().getClientId());
    tokenServices.setRestTemplate(template);
    filter.setTokenServices(tokenServices);
    return filter;
}
 
开发者ID:crispab,项目名称:codekvast,代码行数:11,代码来源:WebSecurityConfig.java


示例16: ssoFilter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private Filter ssoFilter(ClientResources client, String path) {
    OAuth2ClientAuthenticationProcessingFilter oAuth2ClientAuthenticationFilter =
            new OAuth2ClientAuthenticationProcessingFilter(path);
    OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(client.getClient(),
            oAuth2ClientContext);
    oAuth2ClientAuthenticationFilter.setRestTemplate(oAuth2RestTemplate);
    UserInfoTokenServices tokenServices = new UserInfoTokenServices(
            client.getResource().getUserInfoUri(), client.getClient().getClientId());
    tokenServices.setRestTemplate(oAuth2RestTemplate);
    oAuth2ClientAuthenticationFilter.setTokenServices(tokenServices);
    return oAuth2ClientAuthenticationFilter;
}
 
开发者ID:dschadow,项目名称:JavaSecurity,代码行数:13,代码来源:SsoWithGitHubApplication.java


示例17: tokenServices

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
@Bean
@Primary
public ResourceServerTokenServices tokenServices() {
    return new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), resourceServerProperties.getClientId());
}
 
开发者ID:nicolasmanic,项目名称:Facegram,代码行数:6,代码来源:UserApplication.java


示例18: filter

import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices; //导入依赖的package包/类
private OAuth2ClientAuthenticationProcessingFilter filter() {
	OAuth2ClientAuthenticationProcessingFilter oAuth2Filter = new OAuth2ClientAuthenticationProcessingFilter("/google/login");


	OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(authCodeResourceDetails,
			oauth2ClientContext);
	oAuth2Filter.setRestTemplate(oAuth2RestTemplate);


	oAuth2Filter.setTokenServices(new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(),
			resourceServerProperties.getClientId()));


	return oAuth2Filter;
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:16,代码来源:OAuthSecurityConfig.java



注:本文中的org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MySQLFabricException类代码示例发布时间:2022-05-21
下一篇:
Java PullImageResultCallback类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap