Java Code Examples for org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter#setVerifierKey()

The following examples show how to use org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter#setVerifierKey() . 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: OAuthTokenConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 2
Source File: OAuthTokenProducer.java    From Spring-5.0-By-Example with MIT License 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter tokenEnhancer() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey(privateKey);
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 3
Source File: OAuthTokenProducer.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter tokenEnhancer() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setSigningKey(privateKey);
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 4
Source File: OAuthTokenConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 5
Source File: OAuthTokenConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 6
Source File: OAuthTokenConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 7
Source File: OAuthTokenConfiguration.java    From Spring-5.0-By-Example with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 8
Source File: OAuthTokenConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 9
Source File: OAuthTokenConfiguration.java    From Spring-5.0-By-Example with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 10
Source File: AuthorizationServerTokenServicesConfiguration.java    From spring-security-oauth2-boot with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnMissingBean(JwtAccessTokenConverter.class)
public JwtAccessTokenConverter jwtTokenEnhancer() {
	String keyValue = this.authorization.getJwt().getKeyValue();
	Assert.notNull(this.authorization.getJwt().getKeyValue(), "keyValue cannot be null");

	JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
	if (!keyValue.startsWith("-----BEGIN")) {
		converter.setVerifierKey(keyValue);
	}
	converter.setSigningKey(keyValue);

	return converter;
}
 
Example 11
Source File: OauthResourceTokenConfig.java    From spring-boot-demo with MIT License 5 votes vote down vote up
/**
 * jwt 令牌转换
 *
 * @return jwt
 */
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifierKey(getPubKey());
    return converter;
}
 
Example 12
Source File: ResourceServerConfig.java    From spring-cloud-study with Apache License 2.0 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();

    accessTokenConverter.setSigningKey("dev");
    accessTokenConverter.setVerifierKey("dev");
    return accessTokenConverter;
}
 
Example 13
Source File: $ Spring OAuth2 Access Token Decoder.java    From allegro-intellij-templates with Apache License 2.0 5 votes vote down vote up
@Autowired
public $NAME(@Value("${oauth2.tokenKey}") String publicKeyUrl) throws Exception {
    String publicKey = (String) new RestTemplate().getForObject(publicKeyUrl, Map.class).get("value");

    JwtAccessTokenConverter tokenConverter = new JwtAccessTokenConverter();
    tokenConverter.setVerifierKey(publicKey);
    tokenConverter.afterPropertiesSet();

    tokenStore = new JwtTokenStore(tokenConverter);
}
 
Example 14
Source File: ResourceServerConfig.java    From spring-cloud-study with Apache License 2.0 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter accessTokenConverter = new JwtAccessTokenConverter();

    accessTokenConverter.setSigningKey("dev");
    accessTokenConverter.setVerifierKey("dev");
    return accessTokenConverter;
}
 
Example 15
Source File: OAuthTokenConfiguration.java    From Spring-5.0-By-Example with MIT License 5 votes vote down vote up
@Bean
public JwtTokenStore tokenStore() throws Exception {
  JwtAccessTokenConverter enhancer = new JwtAccessTokenConverter();
  enhancer.setSigningKey(privateKey);
  enhancer.setVerifierKey(publicKey);
  enhancer.afterPropertiesSet();
  return new JwtTokenStore(enhancer);
}
 
Example 16
Source File: AuthorizationSeverConfig.java    From springboot-vue.js-bbs with Apache License 2.0 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    KeyStoreKeyFactory keyFactory =
            new KeyStoreKeyFactory(new ClassPathResource("private.jks"), "storepass".toCharArray());
    converter.setKeyPair(keyFactory.getKeyPair("jwtserver", "keypass".toCharArray()));
    converter.setVerifierKey(publicKey);
    return converter;
}
 
Example 17
Source File: OAuth2ResourceServerConfig.java    From spring-boot-demo with MIT License 5 votes vote down vote up
@Bean
public JwtAccessTokenConverter accessTokenConverter(){
  JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
  Resource resource =  new ClassPathResource("public.txt");
  String publicKey;
  try {
    publicKey = inputStream2String(resource.getInputStream());
  } catch (final IOException e) {
    throw new RuntimeException(e);
  }
  converter.setVerifierKey(publicKey);
  converter.setAccessTokenConverter(new CustomerAccessTokenConverter());
  return converter;
}
 
Example 18
Source File: ResourceServerConfig.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifierKey(JWTAuthentication.getPubKey(PUBLIC_KEY));
    return converter;
}
 
Example 19
Source File: ResourceServerConfig.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifierKey(JWTAuthentication.getPubKey(PUBLIC_KEY));
    return converter;
}
 
Example 20
Source File: ResourceServerConfig.java    From codeway_service with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter() {
    JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
    converter.setVerifierKey(JWTAuthentication.getPubKey(PUBLIC_KEY));
    return converter;
}