12
12
import org .springframework .security .oauth2 .config .annotation .web .configuration .EnableAuthorizationServer ;
13
13
import org .springframework .security .oauth2 .config .annotation .web .configurers .AuthorizationServerEndpointsConfigurer ;
14
14
import org .springframework .security .oauth2 .config .annotation .web .configurers .AuthorizationServerSecurityConfigurer ;
15
- import org .springframework .security .oauth2 .provider .token .store .JdbcTokenStore ;
16
15
import org .springframework .security .oauth2 .provider .token .store .JwtAccessTokenConverter ;
17
16
18
17
import javax .sql .DataSource ;
@@ -36,17 +35,14 @@ public class Oauth2AuthorizationConfig extends AuthorizationServerConfigurerAdap
36
35
private String signKey ;
37
36
38
37
@ Override
39
- public void configure (AuthorizationServerSecurityConfigurer security ) throws Exception {
38
+ public void configure (AuthorizationServerSecurityConfigurer security ) {
40
39
security .tokenKeyAccess ("permitAll()" )
41
40
.checkTokenAccess ("isAuthenticated()" ) //allow check token
42
41
.allowFormAuthenticationForClients ();
43
42
}
44
43
45
44
/**
46
45
* 클라이언트 정보 주입 방식을 jdbcdetail로 변경
47
- *
48
- * @param clients
49
- * @throws Exception
50
46
*/
51
47
@ Override
52
48
public void configure (ClientDetailsServiceConfigurer clients ) throws Exception {
@@ -55,35 +51,28 @@ public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
55
51
56
52
/**
57
53
* 토큰 정보를 DB를 통해 관리한다.
58
- *
59
- * @return
60
54
*/
61
- @ Override
62
- public void configure (AuthorizationServerEndpointsConfigurer endpoints ) {
63
- endpoints .tokenStore (new JdbcTokenStore (dataSource )).userDetailsService (userDetailService );
64
- }
55
+ // @Override
56
+ // public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
57
+ // endpoints.tokenStore(new JdbcTokenStore(dataSource)).userDetailsService(userDetailService);
58
+ // }
65
59
66
60
/**
67
61
* 토큰 발급 방식을 JWT 토큰 방식으로 변경한다. 이렇게 하면 토큰 저장하는 DB Table은 필요가 없다.
68
- *
69
- * @param endpoints
70
- * @throws Exception
71
62
*/
72
- // @Override
73
- // public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
74
- // super.configure(endpoints);
75
- // endpoints.accessTokenConverter(jwtAccessTokenConverter()).userDetailsService(userDetailService);
76
- // }
63
+ @ Override
64
+ public void configure (AuthorizationServerEndpointsConfigurer endpoints ) throws Exception {
65
+ super .configure (endpoints );
66
+ endpoints .accessTokenConverter (jwtAccessTokenConverter ()).userDetailsService (userDetailService );
67
+ }
77
68
78
69
/**
79
70
* jwt converter를 등록
80
- *
81
- * @return
82
71
*/
83
- // @Bean
84
- // public JwtAccessTokenConverter jwtAccessTokenConverter() {
85
- // JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
86
- // converter.setSigningKey(signKey);
87
- // return converter;
88
- // }
72
+ @ Bean
73
+ public JwtAccessTokenConverter jwtAccessTokenConverter () {
74
+ JwtAccessTokenConverter converter = new JwtAccessTokenConverter ();
75
+ converter .setSigningKey (signKey );
76
+ return converter ;
77
+ }
89
78
}
0 commit comments