Skip to content

Commit

Permalink
chore: log token
Browse files Browse the repository at this point in the history
  • Loading branch information
Grodien committed Jun 17, 2024
1 parent 03cc0f1 commit 1e3cf1b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand Down Expand Up @@ -63,6 +64,10 @@ String tokenRequest(Authentication authentication, String ru, String train, Stri
@PostMapping
TokenIssuanceStartResponse tokenIssuanceStartEvent(Authentication authentication, @RequestBody TokenIssuanceStartRequest body) {
log.info("Received tokenUssuanceStartEvent with authentication: {}", authentication);
if (authentication.getPrincipal() instanceof JwtAuthenticationToken) {
Map<String, Object> tokenAttributes = ((JwtAuthenticationToken) authentication.getPrincipal()).getTokenAttributes();
tokenAttributes.forEach((k, v) -> log.info("{} -> {}", k, v));
}
log.info("Client: {}", body.data().authenticationContext().client());
log.info("ClientServicePrincipal: {}", body.data().authenticationContext().clientServicePrincipal());
log.info("ResourceServicePrincipal: {}", body.data().authenticationContext().resourceServicePrincipal());
Expand Down

0 comments on commit 1e3cf1b

Please sign in to comment.