Documentation
¶
Overview ¶
Package claims provides shared helpers for decoding JWT/OIDC claim values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeStringArrayLenient ¶
DecodeStringArrayLenient decodes a claim value using the permissive contract the Cedar authorizer has always applied to group/role claims, where a claim that is present but partially malformed must still yield whatever usable names it carries rather than failing the whole authorization decision.
It differs from the strict oauthproto/claims.DecodeStringArray in three ways, each of which Cedar depends on today:
- non-string elements of a []any are dropped instead of raising an error, so an array of all non-strings decodes to a non-nil empty slice;
- a typed nil slice is a recognized array, not an error: []any(nil) decodes to a non-nil empty slice and []string(nil) decodes to nil, preserving each shape's existing nil-ness;
- a recognized but empty []any stays non-nil, so a caller can tell "the IdP asserted this claim with no usable values" (which must suppress a fallback to other claim names) from "the claim is absent" (nil).
recognized reports whether raw was a supported array shape at all. A false value means the claim holds a scalar, object, or other unsupported type; the caller decides whether to log and ignore it. As with the strict decoder, the result never aliases the input.
New security-relevant callers should prefer oauthproto/claims.DecodeStringArray: dropping malformed elements silently is only appropriate where the existing behavior must be preserved.
Types ¶
This section is empty.