Skip to content

Verifying multiple audiences #342

@oberlage

Description

@oberlage

Hi there,

I've just updated to v5 and found that the new RegisteredClaims (in registered_claims.go) struct allows for a []string type via the ClaimStrings type. This opens the way for verifying multiple audiences from the token.

I'm very happy with this, as my authentication provider does provide multiple audiences and v4 gave no option to verify these.

However, the new ParserOption named WithAudience(aud string) and accompanying validator still only allows for a single string audience to be verified.

With RFC 7519 specifically mentioning multiple audiences, it does feel like something nice to support.

"(..) In the general case, the "aud" value is an array of case-sensitive strings (..)"

My questions are as follows:

  1. Are there specific reasons to not implement checking of multiple audiences?
  2. Are there any plans to do so?
  3. If not, how do you feel about having an additional ParserOption called WithAudiences(auds []string) for the specific case of multiple audiences. This would not break the existing WithAudience(..) and add functionality.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions