當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。