本文整理汇总了Java中org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory类的典型用法代码示例。如果您正苦于以下问题:Java KeyStoreKeyFactory类的具体用法?Java KeyStoreKeyFactory怎么用?Java KeyStoreKeyFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeyStoreKeyFactory类属于org.springframework.security.oauth2.provider.token.store包,在下文中一共展示了KeyStoreKeyFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例3: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例4: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例5: accessTokenConverter
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例6: jwtTokenEnhancer
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例7: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例8: tokenEnhancer
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例9: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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;
}
示例10: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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
示例11: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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
示例12: doCreateInstance
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的package包/类
/**
* How to generate a new keystore:
*
* keytool -genkeypair -alias mytestkey -keyalg RSA -dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US"
* -keypass changeme -keystore server.jks -storepass letmein
*/
@Override
protected KeyPair doCreateInstance() throws Exception {
return new KeyStoreKeyFactory(new ClassPathResource("server.jks"), "letmein".toCharArray())
.getKeyPair("mytestkey", "changeme".toCharArray());
}
示例13: jwtAccessTokenConverter
import org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory; //导入依赖的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.KeyStoreKeyFactory; //导入依赖的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.KeyStoreKeyFactory; //导入依赖的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;
}