feat(op): add opentelemetry to token endpoint (#436)

* feat(op): add opentelemetry to token endpoint

* drop go 1.18, add 1.21, do not fail fast
This commit is contained in:
Tim Möhlmann 2023-09-01 11:53:14 +03:00 committed by GitHub
parent 5ade1cd9de
commit 1683b319ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 113 additions and 6 deletions

View file

@ -16,6 +16,10 @@ type JWTAuthorizationGrantExchanger interface {
// JWTProfile handles the OAuth 2.0 JWT Profile Authorization Grant https://tools.ietf.org/html/rfc7523#section-2.1
func JWTProfile(w http.ResponseWriter, r *http.Request, exchanger JWTAuthorizationGrantExchanger) {
ctx, span := tracer.Start(r.Context(), "JWTProfile")
defer span.End()
r = r.WithContext(ctx)
profileRequest, err := ParseJWTProfileGrantRequest(r, exchanger.Decoder())
if err != nil {
RequestError(w, r, err)
@ -56,6 +60,9 @@ func ParseJWTProfileGrantRequest(r *http.Request, decoder httphelper.Decoder) (*
// CreateJWTTokenResponse creates an access_token response for a JWT Profile Grant request
// by default the access_token is an opaque string, but can be specified by implementing the JWTProfileTokenStorage interface
func CreateJWTTokenResponse(ctx context.Context, tokenRequest TokenRequest, creator TokenCreator) (*oidc.AccessTokenResponse, error) {
ctx, span := tracer.Start(ctx, "CreateJWTTokenResponse")
defer span.End()
// return an opaque token as default to not break current implementations
tokenType := AccessTokenTypeBearer