本文整理汇总了Java中org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.setAccessTokenConverter方法的典型用法代码示例。如果您正苦于以下问题:Java JwtAccessTokenConverter.setAccessTokenConverter方法的具体用法?Java JwtAccessTokenConverter.setAccessTokenConverter怎么用?Java JwtAccessTokenConverter.setAccessTokenConverter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter
的用法示例。
在下文中一共展示了JwtAccessTokenConverter.setAccessTokenConverter方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtTokenEnhancer() {
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(
new ClassPathResource("keystore.jks"), "secret".toCharArray())
.getKeyPair("test");
jwtAccessTokenConverter.setKeyPair(keyPair);
DefaultAccessTokenConverter defaultAccessTokenConverter = new DefaultAccessTokenConverter();
defaultAccessTokenConverter.setUserTokenConverter(userAuthenticationConverter());
jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter);
return jwtAccessTokenConverter;
}
示例4: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
/**
* Token converter and enhancer
* @return
*/
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(AccessTokenConverter accessTokenConverter) {
JwtAccessTokenConverter tokenConverter = new JwtAccessTokenConverter();
tokenConverter.setAccessTokenConverter(accessTokenConverter);
return tokenConverter;
}
示例5: tokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter tokenEnhancer() {
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter());
jwtAccessTokenConverter.setSigningKey("123");
return jwtAccessTokenConverter;
}
示例6: tokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter tokenEnhancer(){
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter());
jwtAccessTokenConverter.setSigningKey("123");
return jwtAccessTokenConverter;
}
示例7: 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;
}
示例8: 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);
}
示例9: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setSigningKey(jwtKey);
converter.setVerifierKey(jwtKey);
//Customize how our jwt looks like
DefaultAccessTokenConverter tokenConverter = new DefaultAccessTokenConverter();
tokenConverter.setUserTokenConverter(userJwtTokenConverter);
converter.setAccessTokenConverter(tokenConverter);
return converter;
}
示例10: symmetricTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
@Primary
@Profile("OAuth2ConfigurationTest")
public JwtAccessTokenConverter symmetricTokenConverter(
DefaultAccessTokenConverter defaultAccessTokenConverter) throws Exception {
JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter);
jwtAccessTokenConverter.afterPropertiesSet();
return jwtAccessTokenConverter;
}
示例11: myjwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter myjwtTokenEnhancer() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
DefaultUserAuthenticationConverter userTokenConverter = new ScopeAuthoritiesTokenConverter();
accessTokenConverter.setUserTokenConverter(userTokenConverter);
converter.setAccessTokenConverter(accessTokenConverter);
String keyValue = resource.getJwt().getKeyValue();
if (!StringUtils.hasText(keyValue)) {
try {
keyValue = (String) new RestTemplate().getForObject(
resource.getJwt().getKeyUri(), Map.class).get("value");
}
catch (ResourceAccessException e) {
throw new TokenFetchException("Failed to fetch token key from " + resource.getJwt().getKeyUri(), e);
}
}
else {
if (StringUtils.hasText(keyValue) && !keyValue.startsWith("-----BEGIN")) {
converter.setSigningKey(keyValue);
}
}
converter.setVerifierKey(keyValue);
return converter;
}