spring config again

This commit is contained in:
anhefti 2019-02-04 17:14:16 +01:00
parent 9dacdfb2e2
commit ec26aefadf

View file

@ -16,7 +16,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.annotation.Order;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.password.PasswordEncoder;
@ -76,9 +75,8 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
clients.withClientDetails(this.webServiceClientDetails);
}
@Lazy
@Bean
public TokenStore tokenStore() {
public TokenStore tokenStore(final DataSource dataSource) {
System.out.println("************************* this.dataSource:" + this.dataSource);
return new JdbcTokenStore(this.dataSource);
}
@ -88,7 +86,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
final JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter();
jwtAccessTokenConverter.setAccessTokenConverter(this.accessTokenConverter);
endpoints
.tokenStore(tokenStore())
.tokenStore(tokenStore(this.dataSource))
.authenticationManager(this.authenticationManager)
.userDetailsService(this.webServiceUserDetails)
.accessTokenConverter(jwtAccessTokenConverter);