Skip to content

Commit d70abf2

Browse files
committed
Review comments
1 parent 6b58663 commit d70abf2

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.changelog/22732.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
```release-note:feature
2-
oidc: Added support for client authentication using JWT assertion and PKCE. default PKCE is disable
2+
oidc: add client authentication using JWT assertion and PKCE. default PKCE is disabled.
33
```

internal/go-sso/oidcauth/auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func New(c *Config, logger hclog.Logger) (*Authenticator, error) {
110110
}
111111
}
112112
// Use CAP's OIDC provider to leverage its built-in support for
113+
// both standard client secret and JWT assertion authentication methods
113114
providerConfig, err := capOidc.NewConfig(
114115
a.config.OIDCDiscoveryURL,
115116
a.config.OIDCClientID,

internal/go-sso/oidcauth/oidc.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"strings"
1212
"time"
1313

14-
// HashiCorp CAP (Cloud Authentication Primitives) library for OIDC flows
15-
// Provides enhanced OIDC support including private key JWT client authentication
1614
"github.com/hashicorp/cap/oidc"
1715
cass "github.com/hashicorp/cap/oidc/clientassertion"
1816

@@ -91,10 +89,6 @@ func (a *Authenticator) ClaimsFromAuthCode(ctx context.Context, stateParam, code
9189
}
9290
}
9391

94-
// Use HashiCorp CAP provider for token exchange
95-
// This provider supports private key JWT client authentication if configured
96-
provider := a.capProvider
97-
9892
// Use the stored request object from the initial authorization request
9993
if state.request == nil {
10094
a.logger.Error("Request object not found in state", "stateParam", stateParam)
@@ -103,6 +97,10 @@ func (a *Authenticator) ClaimsFromAuthCode(ctx context.Context, stateParam, code
10397
}
10498
}
10599

100+
// Use HashiCorp CAP provider for token exchange
101+
// This provider supports private key JWT client authentication if configured
102+
provider := a.capProvider
103+
106104
tokens, err := provider.Exchange(ctx, state.request, stateParam, code)
107105
if err != nil {
108106
return nil, nil, &ProviderLoginFailedError{

0 commit comments

Comments
 (0)