当前位置: 首页>>代码示例>>Java>>正文


Java JwtAccessTokenConverter.setKeyPair方法代码示例

本文整理汇总了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);
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:18,代码来源:DomainTokenServicesUnitTest.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:18,代码来源:OAuth2AuthorizationServer.java

示例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;
}
 
开发者ID:andifalk,项目名称:spring-authorization-server,代码行数:15,代码来源:JwtConfiguration.java

示例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;
}
 
开发者ID:rhawan,项目名称:microservices-tcc-alfa,代码行数:8,代码来源:AuthorizationServerConfiguration.java

示例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;
}
 
开发者ID:gdong42,项目名称:spring-auth-example,代码行数:9,代码来源:OAuth2Config.java

示例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;
}
 
开发者ID:tinmegali,项目名称:Using-Spring-Oauth2-to-secure-REST,代码行数:11,代码来源:AuthorizationConfig.java

示例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;
}
 
开发者ID:apssouza22,项目名称:java-microservice,代码行数:11,代码来源:JwtServerConfiguration.java

示例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;
}
 
开发者ID:anilallewar,项目名称:microservices-basics-spring-boot,代码行数:10,代码来源:OAuthServerConfiguration.java

示例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;
}
 
开发者ID:t0bst4r,项目名称:authorizer,代码行数:9,代码来源:JwtConfiguration.java

示例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;
}
 
开发者ID:JerryNiu,项目名称:cloud,代码行数:10,代码来源:AuthorizationServerConfig.java

示例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;
}
 
开发者ID:ksambhav,项目名称:trueyes,代码行数:9,代码来源:AuthorizationServer.java

示例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;
}
 
开发者ID:arunsoman,项目名称:spring-micro-service-jwt,代码行数:8,代码来源:OAuth2Config.java

示例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;
}
 
开发者ID:axel-halin,项目名称:Thesis-JHipster,代码行数:16,代码来源:UaaConfiguration.java


注:本文中的org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter.setKeyPair方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。