authorize: log id token claims separately from id token (#4394)

This commit is contained in:
Caleb Doxsey 2023-07-26 11:45:10 -06:00 committed by GitHub
parent 05c6de3642
commit 6c1416fc0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View file

@ -164,12 +164,15 @@ func populateLogEvent(
return evt.Str(string(field), in.GetAttributes().GetRequest().GetHttp().GetHost())
case log.AuthorizeLogFieldIDToken:
if s, ok := s.(*session.Session); ok {
evt = evt.Str("id-token", s.GetIdToken().GetRaw())
evt = evt.Str(string(field), s.GetIdToken().GetRaw())
}
return evt
case log.AuthorizeLogFieldIDTokenClaims:
if s, ok := s.(*session.Session); ok {
if t, err := jwt.ParseSigned(s.GetIdToken().GetRaw()); err == nil {
var m map[string]any
_ = t.UnsafeClaimsWithoutVerification(&m)
evt = evt.Interface("id-token-claims", m)
evt = evt.Interface(string(field), m)
}
}
return evt