feat(rp): extend tracing

This commit is contained in:
adlerhurst 2024-03-06 18:38:37 +01:00
parent e3e48882df
commit d18aba8cb3
18 changed files with 198 additions and 7 deletions

View file

@ -37,6 +37,10 @@ func tokenHandler(exchanger Exchanger) func(w http.ResponseWriter, r *http.Reque
// Exchange performs a token exchange appropriate for the grant type
func Exchange(w http.ResponseWriter, r *http.Request, exchanger Exchanger) {
ctx, span := tracer.Start(r.Context(), "Exchange")
r = r.WithContext(ctx)
defer span.End()
grantType := r.FormValue("grant_type")
switch grantType {
case string(oidc.GrantTypeCode):
@ -115,6 +119,9 @@ func ParseAuthenticatedTokenRequest(r *http.Request, decoder httphelper.Decoder,
// AuthorizeClientIDSecret authorizes a client by validating the client_id and client_secret (Basic Auth and POST)
func AuthorizeClientIDSecret(ctx context.Context, clientID, clientSecret string, storage Storage) error {
ctx, span := tracer.Start(ctx, "AuthorizeClientIDSecret")
defer span.End()
err := storage.AuthorizeClientIDSecret(ctx, clientID, clientSecret)
if err != nil {
return oidc.ErrInvalidClient().WithDescription("invalid client_id / client_secret").WithParent(err)