当前位置: 首页>>代码示例>>Java>>正文


Java JwtAccessTokenConverter.setVerifierKey方法代码示例

本文整理汇总了Java中org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.setVerifierKey方法的典型用法代码示例。如果您正苦于以下问题:Java JwtAccessTokenConverter.setVerifierKey方法的具体用法?Java JwtAccessTokenConverter.setVerifierKey怎么用?Java JwtAccessTokenConverter.setVerifierKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter的用法示例。


在下文中一共展示了JwtAccessTokenConverter.setVerifierKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jwtTokenEnhancer

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter converter =  new JwtAccessTokenConverter();
    Resource resource = new ClassPathResource("public.cert");
    String publicKey = null;
    try {
        publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
开发者ID:rhawan,项目名称:microservices-tcc-alfa,代码行数:14,代码来源:JwtConfiguration.java

示例2: jwtTokenEnhancer

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	String keyValue = this.resource.getJwt().getKeyValue();
	if (!StringUtils.hasText(keyValue)) {
		keyValue = getKeyFromServer();
	}
	if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
		converter.setSigningKey(keyValue);
	}
	if (keyValue != null) {
		converter.setVerifierKey(keyValue);
	}
	if (!CollectionUtils.isEmpty(this.configurers)) {
		AnnotationAwareOrderComparator.sort(this.configurers);
		for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
			configurer.configure(converter);
		}
	}
	return converter;
}
 
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:22,代码来源:ResourceServerTokenServicesConfiguration.java

示例3: jwtTokenStore

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
/**
 * @return The {@link JwtTokenStore} verifies access tokens and extract
 *         authentication and authorities from it.
 */
@Bean
public JwtTokenStore jwtTokenStore() {
    final DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
    accessTokenConverter.setUserTokenConverter(userPrincipalInfoTokenServices());
    final JwtAccessTokenConverter jwtTokenEnhancer = new JwtAccessTokenConverter();
    jwtTokenEnhancer.setAccessTokenConverter(accessTokenConverter);
    jwtTokenEnhancer.setSigningKey(uaaClientResources.getResource().getJwt().getKeyValue());
    jwtTokenEnhancer.setVerifierKey(uaaClientResources.getResource().getJwt().getKeyValue());
    try {
        jwtTokenEnhancer.afterPropertiesSet();
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
    return new JwtTokenStore(jwtTokenEnhancer);
}
 
开发者ID:eclipse,项目名称:hawkbit-extensions,代码行数:20,代码来源:UaaOAuthAutoConfiguration.java

示例4: accessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setAccessTokenConverter(customAccessTokenConverter);

    // converter.setSigningKey("123");
    final Resource resource = new ClassPathResource("public.txt");
    String publicKey = null;
    try {
        publicKey = IOUtils.toString(resource.getInputStream());
    } catch (final IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
开发者ID:Baeldung,项目名称:spring-security-oauth,代码行数:17,代码来源:OAuth2ResourceServerConfigJwt.java

示例5: jwtTokenEnhancer

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	String keyValue = this.resource.getJwt().getKeyValue();
	if (!StringUtils.hasText(keyValue)) {
		try {
			keyValue = getKeyFromServer();
		}
		catch (ResourceAccessException ex) {
			logger.warn("Failed to fetch token key (you may need to refresh "
					+ "when the auth server is back)");
		}
	}
	if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
		converter.setSigningKey(keyValue);
	}
	if (keyValue != null) {
		converter.setVerifierKey(keyValue);
	}
	AnnotationAwareOrderComparator.sort(this.configurers);
	for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
		configurer.configure(converter);
	}
	return converter;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:26,代码来源:ResourceServerTokenServicesConfiguration.java

示例6: jwtAccessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    JwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromAuthorizationServer(keyUriRestTemplate));
    return converter;
}
 
开发者ID:xm-online,项目名称:xm-ms-balance,代码行数:9,代码来源:MicroserviceSecurityConfiguration.java

示例7: jwtAccessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(keyUriRestTemplate));
    return converter;
}
 
开发者ID:xm-online,项目名称:xm-gate,代码行数:9,代码来源:MicroserviceSecurityConfiguration.java

示例8: jwtTokenEnhancer

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    Resource resource = new ClassPathResource("public.cert");
    String publicKey = null;
    try {
        publicKey = new String(FileCopyUtils.copyToByteArray(resource.getInputStream()));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    converter.setVerifierKey(publicKey);
    return converter;
}
 
开发者ID:apssouza22,项目名称:java-microservice,代码行数:14,代码来源:JwtConfiguration.java

示例9: jwtAccessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(
        @Qualifier("loadBalancedRestTemplate") RestTemplate keyUriRestTemplate) throws CertificateException {

    JwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
    converter.setVerifierKey(getKeyFromConfigServer(keyUriRestTemplate));
    return converter;
}
 
开发者ID:xm-online,项目名称:xm-ms-timeline,代码行数:9,代码来源:MicroserviceSecurityConfiguration.java

示例10: accessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	converter.setSigningKey(privateKey);
	converter.setVerifierKey(publicKey);
	converter.setAccessTokenConverter(tokenConverter);
	return converter;
}
 
开发者ID:PatternFM,项目名称:tokamak,代码行数:9,代码来源:AuthorizationServerConfiguration.java

示例11: tokenEnhancer

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter tokenEnhancer() {
    logger.warn("Initializing JWT with public key:\n" + publicKey);
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey(privateKey);
    converter.setVerifierKey(publicKey);
    return converter;
}
 
开发者ID:javaguru,项目名称:tcloud-microservices,代码行数:9,代码来源:AuthServiceApplication.java

示例12: accessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
 final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
 final Resource resource = new ClassPathResource("public.cert");
 String publicKey = null;
 try {
     publicKey = IOUtils.toString(resource.getInputStream());
 } catch (final IOException e) {
     throw new RuntimeException(e);
 }
 converter.setVerifierKey(publicKey);
 return converter;
}
 
开发者ID:arunsoman,项目名称:spring-micro-service-jwt,代码行数:14,代码来源:JwtConfig.java

示例13: jwtTokenEnhancer

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	String keyValue = this.resource.getJwt().getKeyValue();
	if (!StringUtils.hasText(keyValue)) {
		try {
			keyValue = getKeyFromServer();
		}
		catch (ResourceAccessException ex) {
			logger.warn("Failed to fetch token key (you may need to refresh "
					+ "when the auth server is back)");
		}
	}
	if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
		converter.setSigningKey(keyValue);
	}
	if (keyValue != null) {
		converter.setVerifierKey(keyValue);
	}
	if (!CollectionUtils.isEmpty(this.configurers)) {
		AnnotationAwareOrderComparator.sort(this.configurers);
		for (JwtAccessTokenConverterConfigurer configurer : this.configurers) {
			configurer.configure(converter);
		}
	}
	return converter;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:28,代码来源:ResourceServerTokenServicesConfiguration.java

示例14: accessTokenConverter

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey("123");
    converter.setVerifierKey("123");

    return converter;
}
 
开发者ID:Baeldung,项目名称:spring-security-oauth,代码行数:9,代码来源:OAuth2ResourceServerConfig2.java

示例15: configure

import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Override
public void configure(JwtAccessTokenConverter converter) {
    DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
    accessTokenConverter.setUserTokenConverter(userJwtTokenConverter);
    converter.setAccessTokenConverter(accessTokenConverter);
    converter.setSigningKey(jwtKey);
    converter.setVerifierKey(jwtKey);
}
 
开发者ID:leon,项目名称:spring-oauth-social-microservice-starter,代码行数:9,代码来源:JwtConfig.java


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