|
5 | 5 | import java.security.interfaces.RSAPrivateKey;
|
6 | 6 | import java.security.interfaces.RSAPublicKey;
|
7 | 7 | import java.util.UUID;
|
| 8 | +import org.slf4j.Logger; |
| 9 | +import org.slf4j.LoggerFactory; |
8 | 10 |
|
9 | 11 | import org.springframework.context.annotation.Bean;
|
10 | 12 | import org.springframework.context.annotation.Configuration;
|
|
36 | 38 | @Configuration
|
37 | 39 | @EnableWebSecurity
|
38 | 40 | public class SecurityConfig {
|
39 |
| - |
| 41 | + |
40 | 42 | @Bean
|
41 | 43 | @Order(1)
|
42 | 44 | public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity http)
|
@@ -112,21 +114,24 @@ private static KeyPair generateRsaKey() {
|
112 | 114 | return keyPair;
|
113 | 115 | }
|
114 | 116 |
|
| 117 | + Logger logger = LoggerFactory.getLogger(SecurityConfig.class); |
| 118 | + |
115 | 119 | @Bean
|
116 | 120 | public OAuth2TokenCustomizer<JwtEncodingContext> jwtTokenCustomizer() {
|
| 121 | + logger.info("Creating jwtTokenCustomizer ..."); |
117 | 122 | return (context) -> {
|
118 | 123 | if (OAuth2TokenType.ACCESS_TOKEN.equals(context.getTokenType())) {
|
119 | 124 | AbstractAuthenticationToken principal = context.getPrincipal();
|
120 |
| - System.out.println("registered client: " + context.getRegisteredClient()); |
121 |
| - System.out.println("token format : " + |
| 125 | + logger.info("registered client: {}", context.getRegisteredClient()); |
| 126 | + logger.info("principal : {}", principal); |
| 127 | + logger.info("token format : {} ", |
122 | 128 | context.getRegisteredClient().getTokenSettings().getAccessTokenFormat().getValue());
|
123 |
| - System.out.println("authorities : " + principal.getAuthorities()); |
124 |
| - System.out.println("authorized scopes : " + context.getAuthorizedScopes()); |
| 129 | + logger.info("authorities : {}", principal.getAuthorities()); |
| 130 | + logger.info("authorized scopes : {}", context.getAuthorizedScopes()); |
125 | 131 |
|
126 | 132 | context.getClaims()
|
127 | 133 | .audience(AudienceAuthority.getAll(principal))
|
128 |
| - .claim("extra_scope", ScopeAuthority.getAllUnauthorized(principal, |
129 |
| - context.getAuthorizedScopes())); |
| 134 | + .claim("extra_scope", ScopeAuthority.getAuthorites(principal)); |
130 | 135 | }
|
131 | 136 | };
|
132 | 137 | }
|
|
0 commit comments