diff --git a/filters/auth/oidc.go b/filters/auth/oidc.go index 88c952c52c..f6ade79435 100644 --- a/filters/auth/oidc.go +++ b/filters/auth/oidc.go @@ -843,7 +843,8 @@ func (f *tokenOidcFilter) Request(ctx filters.FilterContext) { } // saving token info for chained filter - ctx.StateBag()[oidcClaimsCacheKey] = container + // ctx.StateBag()[oidcClaimsCacheKey] = container + SetOIDCClaims(ctx, container.Claims) // adding upstream headers err = setHeaders(f.upstreamHeaders, ctx, container) diff --git a/filters/auth/oidc_introspection.go b/filters/auth/oidc_introspection.go index a32752a7c0..8d21dc4ec1 100644 --- a/filters/auth/oidc_introspection.go +++ b/filters/auth/oidc_introspection.go @@ -42,6 +42,14 @@ func NewOIDCQueryClaimsFilter() filters.Spec { } } +// Sets OIDC claims in the state bag. +// Intended for use with the oidcClaimsQuery filter. +func SetOIDCClaims(ctx filters.FilterContext, claims map[string]interface{}) { + ctx.StateBag()[oidcClaimsCacheKey] = tokenContainer{ + Claims: claims, + } +} + func (spec *oidcIntrospectionSpec) Name() string { switch spec.typ { case checkOIDCQueryClaims: