MCPcopy
hub / github.com/golang-jwt/jwt / WithAudience

Function WithAudience

parser_option.go:83–87  ·  view source on GitHub ↗

WithAudience configures the validator to require any of the specified audiences in the `aud` claim. Validation will fail if the audience is not listed in the token or the `aud` claim is missing. NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is application-specific. Since this

(aud ...string)

Source from the content-addressed store, hash-verified

81// writing secure application, we decided to REQUIRE the existence of the claim,
82// if an audience is expected.
83func WithAudience(aud ...string) ParserOption {
84 return func(p *Parser) {
85 p.validator.expectedAud = aud
86 }
87}
88
89// WithAllAudiences configures the validator to require all the specified
90// audiences in the `aud` claim. Validation will fail if the specified audiences

Callers 1

TestVerifyAudFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestVerifyAudFunction · 0.68