Skip to content

Commit c7467c4

Browse files
committed
Added check to ensure 'sub' is present in claim before parsing and use token subjact if sub is not present in claims
Signed-off-by: wassafshahzad <[email protected]>
1 parent 262c326 commit c7467c4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

filters/auth/oidc_introspection.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@ func (filter *oidcIntrospectionFilter) Request(ctx filters.FilterContext) {
131131
return
132132
}
133133

134-
sub := token.Claims["sub"].(string)
135-
authorized(ctx, sub)
134+
sub, ok := token.Claims["sub"]
135+
if ok {
136+
authorized(ctx, sub.(string))
137+
} else {
138+
sub := token.Subject
139+
authorized(ctx, sub)
140+
}
136141
}
137142

138143
func (filter *oidcIntrospectionFilter) Response(filters.FilterContext) {}

0 commit comments

Comments
 (0)