diff --git a/internal/api/authz/context.go b/internal/api/authz/context.go index 52ac598474..abd44c8ead 100644 --- a/internal/api/authz/context.go +++ b/internal/api/authz/context.go @@ -7,6 +7,8 @@ import ( "errors" "strings" + "github.com/zitadel/logging" + "github.com/zitadel/zitadel/internal/api/grpc" http_util "github.com/zitadel/zitadel/internal/api/http" zitadel_errors "github.com/zitadel/zitadel/internal/errors" @@ -107,6 +109,7 @@ func VerifyTokenAndCreateCtxData(ctx context.Context, token, orgID, orgDomain st return CtxData{}, err } if err != nil { + logging.WithFields("org_id", orgID, "org_domain", orgDomain).WithError(err).Warn("authz: verify access token") var sysTokenErr error sysMemberships, userID, sysTokenErr = t.VerifySystemToken(ctx, tokenWOBearer, orgID) if sysTokenErr != nil || sysMemberships == nil { @@ -130,7 +133,7 @@ func VerifyTokenAndCreateCtxData(ctx context.Context, token, orgID, orgDomain st if orgID == "" && orgDomain == "" { orgID = resourceOwner } - // System API calls dont't have a resource owner + // System API calls don't have a resource owner if orgID != "" { orgID, err = t.ExistsOrg(ctx, orgID, orgDomain) if err != nil { diff --git a/internal/authz/repository/eventsourcing/eventstore/token_verifier.go b/internal/authz/repository/eventsourcing/eventstore/token_verifier.go index 823a6da4db..cac3a908ff 100644 --- a/internal/authz/repository/eventsourcing/eventstore/token_verifier.go +++ b/internal/authz/repository/eventsourcing/eventstore/token_verifier.go @@ -263,9 +263,11 @@ func (repo *TokenVerifierRepo) getTokenIDAndSubject(ctx context.Context, accessT // let's try opaque first: tokenIDSubject, err := repo.decryptAccessToken(accessToken) if err != nil { + logging.WithError(err).Warn("token verifier repo: decrypt access token") // if decryption did not work, it might be a JWT accessTokenClaims, err := op.VerifyAccessToken[*oidc.AccessTokenClaims](ctx, accessToken, repo.jwtTokenVerifier(ctx)) if err != nil { + logging.WithError(err).Warn("token verifier repo: verify JWT access token") return "", "", false } return accessTokenClaims.JWTID, accessTokenClaims.Subject, true