Java Code Examples for org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory#getKeyPair()

The following examples show how to use org.springframework.security.oauth2.provider.token.store.KeyStoreKeyFactory#getKeyPair() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthServerConfigurer.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(
        keystore, keystorePassword.toCharArray());
    KeyPair keyPair = keyStoreKeyFactory.getKeyPair(
        keyAlias, keyPassword.toCharArray());
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setKeyPair(keyPair);
    return converter;
}
 
Example 2
Source File: CustomAuthorizationServerConfigurer.java    From spring-microservice-exam with MIT License 4 votes vote down vote up
/**
 * 生成KeyPair
 * @return KeyPair
 */
@Bean
public KeyPair keyPair() {
	KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(keyProperties.getKeyStore().getLocation(), keyProperties.getKeyStore().getPassword().toCharArray());
	return keyStoreKeyFactory.getKeyPair(keyProperties.getKeyStore().getAlias());
}
 
Example 3
Source File: AuthorizationServerConfig.java    From syhthems-platform with MIT License 4 votes vote down vote up
@Bean
public KeyPair keyPair() {
    KeyStoreKeyFactory keyStoreKeyFactory =
            new KeyStoreKeyFactory(new ClassPathResource("syhthems.jks"), "syhthems-sunriseydy".toCharArray());
    return keyStoreKeyFactory.getKeyPair("syhthems");
}
 
Example 4
Source File: JwkAuthorizationServerConfiguration.java    From spring-security-oauth with MIT License 4 votes vote down vote up
@Bean
public KeyPair keyPair() {
    ClassPathResource ksFile = new ClassPathResource(KEY_STORE_FILE);
    KeyStoreKeyFactory ksFactory = new KeyStoreKeyFactory(ksFile, KEY_STORE_PASSWORD.toCharArray());
    return ksFactory.getKeyPair(KEY_ALIAS);
}
 
Example 5
Source File: SecurityConfig.java    From platform with Apache License 2.0 4 votes vote down vote up
@Bean
public KeyPair keyPair() {
    KeyStoreKeyFactory keyStoreKeyFactory =
            new KeyStoreKeyFactory(new ClassPathResource("jwt/jwt.jks"), "jwttest".toCharArray());
    return keyStoreKeyFactory.getKeyPair("jwttest");
}
 
Example 6
Source File: Oauth2AuthorizationTokenConfig.java    From spring-boot-demo with MIT License 2 votes vote down vote up
/**
 * 密钥  keyPair.
 * 可用于生成 jwt / jwk.
 *
 * @return keyPair
 */
@Bean
public KeyPair keyPair() {
    KeyStoreKeyFactory keyStoreKeyFactory = new KeyStoreKeyFactory(new ClassPathResource("oauth2.jks"), "123456".toCharArray());
    return keyStoreKeyFactory.getKeyPair("oauth2");
}