Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT Example, Chapter 7, How do DefaultTokenServices defaultTokenServices work? #10

Open
ChaosDeSelva opened this issue Jan 29, 2019 · 0 comments

Comments

@ChaosDeSelva
Copy link

In file JWTOAuth2Config.java shouldn't the configure function also have endpoints.tokenServices(tokenServices) ? tokenServices is autowired in this file but never used? When I add it myself I lose the JWT token and start getting the original oauth uid token again.

`
@OverRide
public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
tokenEnhancerChain.setTokenEnhancers(Arrays.asList(jwtTokenEnhancer, jwtAccessTokenConverter));

	endpoints.tokenStore(tokenStore)
		.accessTokenConverter(jwtAccessTokenConverter)
		.tokenEnhancer(tokenEnhancerChain)
		.tokenServices(tokenServices) // I added this
		.authenticationManager(authenticationManager)
		.userDetailsService(userDetailsService);
}

`

I am confused how the DefaultTokenServices work because I added defaultTokenServices.setAccessTokenValiditySeconds(7200); and its not working. So I am confused how tokenServices even work in this setup?

`
@bean
@primary
public DefaultTokenServices tokenServices() {
DefaultTokenServices defaultTokenServices = new DefaultTokenServices();

	defaultTokenServices.setTokenStore(tokenStore());
	defaultTokenServices.setAccessTokenValiditySeconds(7200);  // I added this
	defaultTokenServices.setSupportRefreshToken(true);
	return defaultTokenServices;
}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant