本文整理匯總了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;
}