當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。