From 03721d11404f2ffef68219429a57e04d28d64b63 Mon Sep 17 00:00:00 2001 From: wassafshahzad Date: Sat, 26 Oct 2024 02:49:07 +0200 Subject: [PATCH] Added check to ensure 'sub' is present in claim before parsing and use token subjact if sub is not present in claims --- filters/auth/oidc_introspection.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/filters/auth/oidc_introspection.go b/filters/auth/oidc_introspection.go index a32752a7c0..cdde259678 100644 --- a/filters/auth/oidc_introspection.go +++ b/filters/auth/oidc_introspection.go @@ -131,8 +131,13 @@ func (filter *oidcIntrospectionFilter) Request(ctx filters.FilterContext) { return } - sub := token.Claims["sub"].(string) - authorized(ctx, sub) + sub, ok := token.Claims["sub"] + if ok { + authorized(ctx, sub.(string)) + } else { + sub := token.Subject + authorized(ctx, sub) + } } func (filter *oidcIntrospectionFilter) Response(filters.FilterContext) {}