use of com.framework.auth.config.support.CustomerAccessTokenConverter in project new-cloud by xie-summer.
the class OAuth2JWTAuthorizationConfig method jwtAccessTokenConverter.
/**
* 使用JWT对称加密
* @return
*/
// @Bean
// public JwtAccessTokenConverter jwtAccessTokenConverter() {
// JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
// jwtAccessTokenConverter.setSigningKey(CommonConstant.SIGN_KEY);
// return jwtAccessTokenConverter;
// }
/**
* 使用JWT不对称加密 ,认证中加密,资源服务器验签解密
* @return
*/
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
final JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("mytest.jks"), "mypass".toCharArray());
converter.setKeyPair(keyStoreKeyFactory.getKeyPair("mytest"));
converter.setAccessTokenConverter(new CustomerAccessTokenConverter());
return converter;
}
use of com.framework.auth.config.support.CustomerAccessTokenConverter in project new-cloud by xie-summer.
the class ResourceServerConfiguration method accessTokenConverter.
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
Resource resource = new ClassPathResource("public.txt");
String publicKey = null;
try {
publicKey = inputStream2String(resource.getInputStream());
} catch (final IOException e) {
throw new RuntimeException(e);
}
converter.setVerifierKey(publicKey);
converter.setAccessTokenConverter(new CustomerAccessTokenConverter());
return converter;
}
Aggregations