Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Added logic to MapClaims to allow 'aud' to be an array of strings #315

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danapsimer
Copy link

The JWT spec allows "aud" to be either a single string or an array of strings. This change should be backward compatible with previous versions.

@rbarilani
Copy link

👍

@vtolstov
Copy link

@dgrijalva why this is not merged? or you want to first move to new release?

@leosunmo
Copy link

This is a critical feature for me. A common pattern in OIDC is to append a domain.com/userdata Aud in order to retrieve extra user info. This is a big part of OIDC and definitely doesn't work right now unless you roll your own CustomClaims with all of the methods required to verify it.

func verifyAud(aud string, cmp string, required bool) bool {
if aud == "" {
func verifyAud(auds []string, cmp string, required bool) bool {
if auds == nil || len(auds) == 0 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auds == nil is not necessary, len(auds) covers both cases: https://play.golang.org/p/rzZoRNYYo9N

aud, _ := m["aud"].(string)
var aud []string
switch exp := m["aud"].(type) {
case string:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong Indentation

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants