當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceServerTokenServices類代碼示例

本文整理匯總了Java中org.springframework.security.oauth2.provider.token.ResourceServerTokenServices的典型用法代碼示例。如果您正苦於以下問題:Java ResourceServerTokenServices類的具體用法?Java ResourceServerTokenServices怎麽用?Java ResourceServerTokenServices使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResourceServerTokenServices類屬於org.springframework.security.oauth2.provider.token包,在下文中一共展示了ResourceServerTokenServices類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: userInfoTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean({ ConnectionFactoryLocator.class,
		ResourceServerTokenServices.class })
public UserInfoTokenServices userInfoTokenServices() {
	UserInfoTokenServices services = new UserInfoTokenServices(
			this.sso.getUserInfoUri(), this.sso.getClientId());
	services.setTokenType(this.sso.getTokenType());
	services.setRestTemplate(this.restTemplate);
	if (this.authoritiesExtractor != null) {
		services.setAuthoritiesExtractor(this.authoritiesExtractor);
	}
	if (this.principalExtractor != null) {
		services.setPrincipalExtractor(this.principalExtractor);
	}
	return services;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:17,代碼來源:ResourceServerTokenServicesConfiguration.java

示例2: tokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
public ResourceServerTokenServices tokenServices() {
  final RemoteTokenServices remoteTokenServices = new RemoteTokenServices();
  remoteTokenServices.setClientId(this.clientId);
  remoteTokenServices.setClientSecret(this.clientSecret);
  remoteTokenServices.setCheckTokenEndpointUrl(this.checkTokenUrl);
  return remoteTokenServices;
}
 
開發者ID:brahalla,項目名稱:oauth2,代碼行數:9,代碼來源:OAuth2ResourceServerConfiguration.java

示例3: mockResourceTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
public ResourceServerTokenServices mockResourceTokenServices() {
    final ResourceServerTokenServices tokenServices = mock(ResourceServerTokenServices.class);

    when(tokenServices.loadAuthentication(any())).thenAnswer(invocation -> {

        final UsernamePasswordAuthenticationToken user = new UsernamePasswordAuthenticationToken("user", "N/A",
                AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER"));

        final String token = (String) invocation.getArguments()[0];
        final Set<String> scopes = ImmutableSet.copyOf(scopesForTokens.get(token));
        final Map<String, Object> details = new HashMap<>();
        details.put("realm", realms.get(token));
        user.setDetails(details);

        final OAuth2Request request = new OAuth2Request(null, null, null, true, scopes, null, null, null, null);

        return new OAuth2Authentication(request, user);
    });
    return tokenServices;
}
 
開發者ID:zalando,項目名稱:nakadi,代碼行數:22,代碼來源:AuthenticationTest.java

示例4: socialTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
@ConditionalOnBean(ConnectionFactoryLocator.class)
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public SpringSocialTokenServices socialTokenServices() {
	return new SpringSocialTokenServices(this.connectionFactory,
			this.sso.getClientId());
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:8,代碼來源:ResourceServerTokenServicesConfiguration.java

示例5: jwkTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public DefaultTokenServices jwkTokenServices(TokenStore jwkTokenStore) {
	DefaultTokenServices services = new DefaultTokenServices();
	services.setTokenStore(jwkTokenStore);
	return services;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:8,代碼來源:ResourceServerTokenServicesConfiguration.java

示例6: jwtTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public DefaultTokenServices jwtTokenServices(TokenStore jwtTokenStore) {
	DefaultTokenServices services = new DefaultTokenServices();
	services.setTokenStore(jwtTokenStore);
	return services;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:8,代碼來源:ResourceServerTokenServicesConfiguration.java

示例7: oauth2SsoFilter

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
private OAuth2ClientAuthenticationProcessingFilter oauth2SsoFilter(
		OAuth2SsoProperties sso) {
	OAuth2RestOperations restTemplate = this.applicationContext
			.getBean(UserInfoRestTemplateFactory.class).getUserInfoRestTemplate();
	ResourceServerTokenServices tokenServices = this.applicationContext
			.getBean(ResourceServerTokenServices.class);
	OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(
			sso.getLoginPath());
	filter.setRestTemplate(restTemplate);
	filter.setTokenServices(tokenServices);
	filter.setApplicationEventPublisher(this.applicationContext);
	return filter;
}
 
開發者ID:spring-projects,項目名稱:spring-security-oauth2-boot,代碼行數:14,代碼來源:SsoSecurityConfigurer.java

示例8: usingRemoteTokenServicesShouldReturnDependency

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Test
public void usingRemoteTokenServicesShouldReturnDependency() {
    ResourceServerTokenServices tokenService = new RemoteTokenServices();
    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

示例9: usingRemoteTokenServicesWithCustomName

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Test
public void usingRemoteTokenServicesWithCustomName() {
    ResourceServerTokenServices tokenService = new RemoteTokenServices();
    detector = new AuthorizationServerRelationshipDetector(tokenService);
    String customName = "authz";
    detector.setDefaultName(customName);
    Set<Relationship> expected = new HashSet<>(
            Arrays.asList(Dependency.on(Component.of(customName, ComponentType.HTTP_APPLICATION))));
    Set<Relationship> result = detector.detect();
    Assertions.assertThat(result).isEqualTo(expected);

}
 
開發者ID:cereebro,項目名稱:cereebro,代碼行數:13,代碼來源:AuthorizationServerRelationshipDetectorTest.java

示例10: usingUserInfoTokenServicesShouldReturnDependency

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的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

示例11: remoteTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
public
@Bean
ResourceServerTokenServices remoteTokenServices() {
    RemoteTokenServices rts = new RemoteTokenServices();
    rts.setClientId("type-server");
    rts.setClientSecret("1a9030fbca47a5b2c28e92f19050bb77824b5ad1");
    rts.setCheckTokenEndpointUrl("http://localhost:8083/oauth/check_token");
    return rts;
}
 
開發者ID:openwms,項目名稱:webworms,代碼行數:10,代碼來源:ResourceServerConfiguration.java

示例12: jwtTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
public DefaultTokenServices jwtTokenServices() {
	DefaultTokenServices services = new DefaultTokenServices();
	services.setTokenStore(jwtTokenStore());
	return services;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:8,代碼來源:ResourceServerTokenServicesConfiguration.java

示例13: customResourceTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
public ResourceServerTokenServices customResourceTokenServices() {
    return new TokenInfoResourceServerTokenServices("pazuzu-registry",
            new ClientIdAuthorityGrantingAuthenticationExtractor(registryProperties.getAdmins(), Roles.ADMIN),
            ExecutorWrappers
                    .wrap(new DefaultTokenInfoRequestExecutor(
                            accessTokensBeanProperties.getTokenInfoUri().toString())));
}
 
開發者ID:pazuzu-io,項目名稱:pazuzu-registry,代碼行數:9,代碼來源:OAuthConfiguration.java

示例14: oauth2SsoFilter

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
private OAuth2ClientAuthenticationProcessingFilter oauth2SsoFilter(
        OAuth2SsoProperties sso) {
    OAuth2RestOperations restTemplate = this.beanFactory
            .getBean(OAuth2RestOperations.class);
    ResourceServerTokenServices tokenServices = this.beanFactory
            .getBean(ResourceServerTokenServices.class);
    OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter(
            sso.getLoginPath());
    filter.setRestTemplate(restTemplate);
    filter.setTokenServices(tokenServices);
    return filter;
}
 
開發者ID:dick-the-deployer,項目名稱:dick,代碼行數:13,代碼來源:SsoSecurityAutoConfiguration.java

示例15: userInfoTokenServices

import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices; //導入依賴的package包/類
@Bean
@ConditionalOnMissingBean({ ConnectionFactoryLocator.class,
		ResourceServerTokenServices.class })
public UserInfoTokenServices userInfoTokenServices() {
	UserInfoTokenServices services = new UserInfoTokenServices(
			this.sso.getUserInfoUri(), this.sso.getClientId());
	services.setTokenType(this.sso.getTokenType());
	services.setRestTemplate(this.restTemplate);
	if (this.authoritiesExtractor != null) {
		services.setAuthoritiesExtractor(this.authoritiesExtractor);
	}
	return services;
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:14,代碼來源:ResourceServerTokenServicesConfiguration.java


注:本文中的org.springframework.security.oauth2.provider.token.ResourceServerTokenServices類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。