Debian Codegraph @

pkg/client/jwt_profile.go

raw
1 package client
2
3 import (
4 "context"
5 "net/url"
6
7 "golang.org/x/oauth2"
8
9 "github.com/zitadel/oidc/v3/pkg/http"
10 "github.com/zitadel/oidc/v3/pkg/oidc"
11 )
12
13 // JWTProfileExchange handles the oauth2 jwt profile exchange
14 func JWTProfileExchange(ctx context.Context, jwtProfileGrantRequest *oidc.JWTProfileGrantRequest, caller TokenEndpointCaller) (*oauth2.Token, error) {
15 return CallTokenEndpoint(ctx, jwtProfileGrantRequest, caller)
16 }
17
18 func ClientAssertionCodeOptions(assertion string) []oauth2.AuthCodeOption {
19 return []oauth2.AuthCodeOption{
20 oauth2.SetAuthURLParam("client_assertion", assertion),
21 oauth2.SetAuthURLParam("client_assertion_type", oidc.ClientAssertionTypeJWTAssertion),
22 }
23 }
24
25 func ClientAssertionFormAuthorization(assertion string) http.FormAuthorization {
26 return func(values url.Values) {
27 values.Set("client_assertion", assertion)
28 values.Set("client_assertion_type", oidc.ClientAssertionTypeJWTAssertion)
29 }
30 }