本文整理汇总了Java中org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.setKeyPair方法的典型用法代码示例。如果您正苦于以下问题:Java JwtAccessTokenConverter.setKeyPair方法的具体用法?Java JwtAccessTokenConverter.setKeyPair怎么用?Java JwtAccessTokenConverter.setKeyPair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter
的用法示例。
在下文中一共展示了JwtAccessTokenConverter.setKeyPair方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
JwtAccessTokenConverter converter = new DomainJwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(
new ClassPathResource(KEYSTORE_PATH), KEYSTORE_PSWRD.toCharArray())
.getKeyPair(KEYSTORE_ALIAS);
converter.setKeyPair(keyPair);
converter.afterPropertiesSet();
tokenStore = new JwtTokenStore(converter);
tokenServices = new DomainTokenServices();
tokenServices.setTokenStore(tokenStore);
tokenServices.setTokenEnhancer(converter);
tokenServices.setTenantPropertiesService(tenantPropertiesService);
when(tenantPropertiesService.getTenantProps()).thenReturn(tenantProperties);
when(tenantProperties.getSecurity()).thenReturn(security);
}
示例2: accessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
try {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
keyGen.initialize(1024, random);
KeyPair keyPair = keyGen.generateKeyPair();
converter.setKeyPair(keyPair);
} catch (Exception e) {
throw new RuntimeException(e);
}
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: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("jwt.jks"), "sales123".toCharArray());
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
return converter;
}
示例5: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(
new ClassPathResource("jwt.jks"), "mySecretKey".toCharArray());
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
return converter;
}
示例6: accessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyStoreKeyFactory keyStoreKeyFactory =
new KeyStoreKeyFactory(
new ClassPathResource("mykeys.jks"),
"mypass".toCharArray());
converter.setKeyPair(keyStoreKeyFactory.getKeyPair("mykeys"));
return converter;
}
示例7: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(
new ClassPathResource("jwt.jks"),
ENC_PASSWORD.toCharArray()
);
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
return converter;
}
示例8: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
//Keypair is the alias name -> anilkeystore.jks / password / anila
KeyPair keyPair = new KeyStoreKeyFactory(new ClassPathResource("anilkeystore.jks"), "password".toCharArray())
.getKeyPair("anila");
converter.setKeyPair(keyPair);
return converter;
}
示例9: tokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public TokenEnhancer tokenEnhancer() throws FileNotFoundException {
Resource fr = validateJwtConfiguration();
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(fr, jwtSecret.toCharArray());
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setKeyPair(keyStoreKeyFactory.getKeyPair(jwtAlias));
return converter;
}
示例10: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {//TODO 重新胜场jks替换
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(
new ClassPathResource("keystore.jks"), "foobar".toCharArray())
.getKeyPair("test");
converter.setKeyPair(keyPair);
return converter;
}
示例11: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(
new ClassPathResource(keystore),
keyStorePass.toCharArray()
).getKeyPair(keyPairAlias);
converter.setKeyPair(keyPair);
return converter;
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:12,代码来源:OAuth2AuthorizationServerConfig.java
示例12: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(
new ClassPathResource("keys/jwtConverterStore.jks"),
keyStorePass.toCharArray()
).getKeyPair(keyPairAlias);
converter.setKeyPair(keyPair);
return converter;
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:12,代码来源:OAuth2AuthorizationServerConfig.java
示例13: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(new ClassPathResource("keystore.jks"), "foobar".toCharArray())
.getKeyPair("test");
converter.setKeyPair(keyPair);
return converter;
}
示例14: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
@Bean
protected JwtAccessTokenConverter jwtTokenEnhancer() {
KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("jwt.jks"), "mySecretKey".toCharArray());
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
converter.setKeyPair(keyStoreKeyFactory.getKeyPair("jwt"));
return converter;
}
示例15: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; //导入方法依赖的package包/类
/**
* This bean generates an token enhancer, which manages the exchange between JWT acces tokens and Authentication
* in both direction.
*
* @return an access token converter configured with the authorization server's public/private keys
*/
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
KeyPair keyPair = new KeyStoreKeyFactory(
new ClassPathResource("keystore.jks"), "password".toCharArray())
.getKeyPair("selfsigned");
converter.setKeyPair(keyPair);
return converter;
}