Skip to content

Commit

Permalink
fix(oidc): userinfo endpoint returns additional audience (#5781)
Browse files Browse the repository at this point in the history
This fixes an issue where the userinfo endpoint returns the client id as an audience twice.

Signed-off-by: James Elliott <james-d-elliott@users.noreply.github.com>
  • Loading branch information
james-d-elliott committed Aug 4, 2023
1 parent 3292873 commit 0919173
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions internal/handlers/handler_oidc_userinfo.go
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/authelia/authelia/v4/internal/middlewares"
"github.com/authelia/authelia/v4/internal/model"
"github.com/authelia/authelia/v4/internal/oidc"
"github.com/authelia/authelia/v4/internal/utils"
)

// OpenIDConnectUserinfo handles GET/POST requests to the OpenID Connect 1.0 UserInfo endpoint.
Expand Down Expand Up @@ -78,19 +79,8 @@ func OpenIDConnectUserinfo(ctx *middlewares.AutheliaCtx, rw http.ResponseWriter,

if !ok || len(audience) == 0 {
audience = []string{client.GetID()}
} else {
found := false

for _, aud := range audience {
if aud == clientID {
found = true
break
}
}

if found {
audience = append(audience, clientID)
}
} else if !utils.IsStringInSlice(clientID, audience) {
audience = append(audience, clientID)
}

claims[oidc.ClaimAudience] = audience
Expand Down

0 comments on commit 0919173

Please sign in to comment.