Skip to content

Commit

Permalink
set claims in event
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl committed Mar 5, 2024
1 parent f8fbb00 commit b6e0bc5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion selfservice/strategy/oidc/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (
"path/filepath"
"strings"

"golang.org/x/exp/maps"

"github.com/ory/x/urlx"

"go.opentelemetry.io/otel/attribute"
Expand Down Expand Up @@ -384,12 +386,16 @@ func (s *Strategy) HandleCallback(w http.ResponseWriter, r *http.Request, ps htt
var (
code = stringsx.Coalesce(r.URL.Query().Get("code"), r.URL.Query().Get("authCode"))
pid = ps.ByName("provider")
err error
)

ctx := r.Context()
ctx = context.WithValue(ctx, httprouter.ParamsKey, ps)
r = r.WithContext(ctx)

ctx, span := s.d.Tracer(ctx).Tracer().Start(ctx, "strategy.oidc.ExchangeCode")

Check failure on line 396 in selfservice/strategy/oidc/strategy.go

View workflow job for this annotation

GitHub Actions / Run tests and lints

SA4006: this value of `ctx` is never used (staticcheck)

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This definition of ctx is never used.
defer otelx.End(span, &err)

req, cntnr, err := s.ValidateCallback(w, r)
if err != nil {
if req != nil {
Expand Down Expand Up @@ -447,11 +453,13 @@ func (s *Strategy) HandleCallback(w http.ResponseWriter, r *http.Request, ps htt
}
}

if err := claims.Validate(); err != nil {
if err = claims.Validate(); err != nil {
s.forwardError(w, r, req, s.handleError(w, r, req, pid, nil, err))
return
}

span.SetAttributes(attribute.StringSlice("claims", maps.Keys(claims.RawClaims)))

switch a := req.(type) {
case *login.Flow:
if ff, err := s.processLogin(w, r, a, et, claims, provider, cntnr); err != nil {
Expand Down

0 comments on commit b6e0bc5

Please sign in to comment.