Skip to content

Commit 2111f98

Browse files
committed
Skip ClientID Check
- adding the option to skip the client id check, defaults to false
1 parent c797a55 commit 2111f98

23 files changed

+93
-79
lines changed

key/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// Package key is DEPRECATED. Use github.com/coreos/go-oidc instead.
1+
// Package key is DEPRECATED. Use github.com/gambol99/go-oidc instead.
22
package key

key/key.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"io"
99
"time"
1010

11-
"github.com/coreos/go-oidc/jose"
11+
"github.com/gambol99/go-oidc/jose"
1212
)
1313

1414
func NewPublicKey(jwk jose.JWK) *PublicKey {

key/key_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/coreos/go-oidc/jose"
10+
"github.com/gambol99/go-oidc/jose"
1111
)
1212

1313
func TestPrivateRSAKeyJWK(t *testing.T) {

key/manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
"github.com/jonboulle/clockwork"
88

9-
"github.com/coreos/go-oidc/jose"
109
"github.com/coreos/pkg/health"
10+
"github.com/gambol99/go-oidc/jose"
1111
)
1212

1313
type PrivateKeyManager interface {

key/manager_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
"github.com/jonboulle/clockwork"
1212

13-
"github.com/coreos/go-oidc/jose"
13+
"github.com/gambol99/go-oidc/jose"
1414
)
1515

1616
var (

oauth2/oauth2.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"strconv"
1313
"strings"
1414

15-
phttp "github.com/coreos/go-oidc/http"
15+
phttp "github.com/gambol99/go-oidc/http"
1616
)
1717

1818
// ResponseTypesEqual compares two response_type values. If either

oauth2/oauth2_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strings"
1111
"testing"
1212

13-
phttp "github.com/coreos/go-oidc/http"
13+
phttp "github.com/gambol99/go-oidc/http"
1414
)
1515

1616
func TestResponseTypesEqual(t *testing.T) {

oidc/client.go

+30-22
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"sync"
1111
"time"
1212

13-
phttp "github.com/coreos/go-oidc/http"
14-
"github.com/coreos/go-oidc/jose"
15-
"github.com/coreos/go-oidc/key"
16-
"github.com/coreos/go-oidc/oauth2"
13+
phttp "github.com/gambol99/go-oidc/http"
14+
"github.com/gambol99/go-oidc/jose"
15+
"github.com/gambol99/go-oidc/key"
16+
"github.com/gambol99/go-oidc/oauth2"
1717
)
1818

1919
const (
@@ -408,7 +408,7 @@ func emailsToStrings(addrs []mail.Address) []string {
408408
//
409409
// NOTE(ericchiang): For development purposes Valid does not mandate 'https' for
410410
// URLs fields where the OIDC spec requires it. This may change in future releases
411-
// of this package. See: https://github.com/coreos/go-oidc/issues/34
411+
// of this package. See: https://github.com/gambol99/go-oidc/issues/34
412412
func (m *ClientMetadata) Valid() error {
413413
if len(m.RedirectURIs) == 0 {
414414
return errors.New("zero redirect URLs")
@@ -556,12 +556,13 @@ func (c *ClientRegistrationResponse) UnmarshalJSON(data []byte) error {
556556
}
557557

558558
type ClientConfig struct {
559-
HTTPClient phttp.Client
560-
Credentials ClientCredentials
561-
Scope []string
562-
RedirectURL string
563-
ProviderConfig ProviderConfig
564-
KeySet key.PublicKeySet
559+
Credentials ClientCredentials
560+
HTTPClient phttp.Client
561+
KeySet key.PublicKeySet
562+
ProviderConfig ProviderConfig
563+
RedirectURL string
564+
Scope []string
565+
SkipClientIDCheck bool
565566
}
566567

567568
func NewClient(cfg ClientConfig) (*Client, error) {
@@ -579,6 +580,7 @@ func NewClient(cfg ClientConfig) (*Client, error) {
579580
redirectURL: ru.String(),
580581
providerConfig: newProviderConfigRepo(cfg.ProviderConfig),
581582
keySet: cfg.KeySet,
583+
skipClientID: cfg.SkipClientIDCheck,
582584
}
583585

584586
if c.httpClient == nil {
@@ -593,19 +595,21 @@ func NewClient(cfg ClientConfig) (*Client, error) {
593595
return &c, nil
594596
}
595597

598+
// Client is the oidc client
596599
type Client struct {
597-
httpClient phttp.Client
598-
providerConfig *providerConfigRepo
599-
credentials ClientCredentials
600-
redirectURL string
601-
scope []string
602-
keySet key.PublicKeySet
603-
providerSyncer *ProviderConfigSyncer
604-
600+
credentials ClientCredentials
601+
httpClient phttp.Client
602+
keySet key.PublicKeySet
605603
keySetSyncMutex sync.RWMutex
606604
lastKeySetSync time.Time
605+
providerConfig *providerConfigRepo
606+
providerSyncer *ProviderConfigSyncer
607+
redirectURL string
608+
scope []string
609+
skipClientID bool
607610
}
608611

612+
// Healthy checks the provider is healthy
609613
func (c *Client) Healthy() error {
610614
now := time.Now().UTC()
611615

@@ -622,6 +626,7 @@ func (c *Client) Healthy() error {
622626
return nil
623627
}
624628

629+
// OAuthClient returns a oauth2 client
625630
func (c *Client) OAuthClient() (*oauth2.Client, error) {
626631
cfg := c.providerConfig.Get()
627632
authMethod, err := chooseAuthMethod(cfg)
@@ -771,18 +776,21 @@ func (c *Client) RefreshToken(refreshToken string) (jose.JWT, error) {
771776
return jwt, c.VerifyJWT(jwt)
772777
}
773778

779+
// VerifyJWT verifies the JWT tokens
774780
func (c *Client) VerifyJWT(jwt jose.JWT) error {
775781
var keysFunc func() []key.PublicKey
776-
if kID, ok := jwt.KeyID(); ok {
777-
keysFunc = c.keysFuncWithID(kID)
782+
if kid, ok := jwt.KeyID(); ok {
783+
keysFunc = c.keysFuncWithID(kid)
778784
} else {
779785
keysFunc = c.keysFuncAll()
780786
}
781787

782788
v := NewJWTVerifier(
783789
c.providerConfig.Get().Issuer.String(),
784790
c.credentials.ID,
785-
c.maybeSyncKeys, keysFunc)
791+
c.maybeSyncKeys,
792+
keysFunc,
793+
c.skipClientID)
786794

787795
return v.Verify(jwt)
788796
}

oidc/client_race_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func TestProviderSyncRace(t *testing.T) {
5959
}
6060

6161
if !cli.providerConfig.Get().Empty() {
62-
t.Errorf("want c.ProviderConfig == nil, got c.ProviderConfig=%#v")
62+
t.Errorf("want c.ProviderConfig == nil, got c.ProviderConfig=%#v", cli.providerConfig)
6363
}
6464

6565
// SyncProviderConfig beings a goroutine which writes to the client's provider config.

oidc/client_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/coreos/go-oidc/jose"
12-
"github.com/coreos/go-oidc/key"
13-
"github.com/coreos/go-oidc/oauth2"
11+
"github.com/gambol99/go-oidc/jose"
12+
"github.com/gambol99/go-oidc/key"
13+
"github.com/gambol99/go-oidc/oauth2"
1414
"github.com/kylelemons/godebug/pretty"
1515
)
1616

oidc/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// Package oidc is DEPRECATED. Use github.com/coreos/go-oidc instead.
1+
// Package oidc is DEPRECATED. Use github.com/gambol99/go-oidc instead.
22
package oidc

oidc/identity.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"errors"
55
"time"
66

7-
"github.com/coreos/go-oidc/jose"
7+
"github.com/gambol99/go-oidc/jose"
88
)
99

1010
type Identity struct {

oidc/identity_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66
"time"
77

8-
"github.com/coreos/go-oidc/jose"
8+
"github.com/gambol99/go-oidc/jose"
99
)
1010

1111
func TestIdentityFromClaims(t *testing.T) {

oidc/key.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"net/http"
77
"time"
88

9-
phttp "github.com/coreos/go-oidc/http"
10-
"github.com/coreos/go-oidc/jose"
11-
"github.com/coreos/go-oidc/key"
9+
phttp "github.com/gambol99/go-oidc/http"
10+
"github.com/gambol99/go-oidc/jose"
11+
"github.com/gambol99/go-oidc/key"
1212
)
1313

1414
// DefaultPublicKeySetTTL is the default TTL set on the PublicKeySet if no

oidc/provider.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"github.com/coreos/pkg/timeutil"
1515
"github.com/jonboulle/clockwork"
1616

17-
phttp "github.com/coreos/go-oidc/http"
18-
"github.com/coreos/go-oidc/oauth2"
17+
phttp "github.com/gambol99/go-oidc/http"
18+
"github.com/gambol99/go-oidc/oauth2"
1919
)
2020

2121
const (
@@ -325,7 +325,7 @@ func contains(sli []string, ele string) bool {
325325
//
326326
// NOTE(ericchiang): For development purposes Valid does not mandate 'https' for
327327
// URLs fields where the OIDC spec requires it. This may change in future releases
328-
// of this package. See: https://github.com/coreos/go-oidc/issues/34
328+
// of this package. See: https://github.com/gambol99/go-oidc/issues/34
329329
func (p ProviderConfig) Valid() error {
330330
grantTypes := p.GrantTypesSupported
331331
if len(grantTypes) == 0 {

oidc/provider_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717
"github.com/kylelemons/godebug/diff"
1818
"github.com/kylelemons/godebug/pretty"
1919

20-
"github.com/coreos/go-oidc/jose"
21-
"github.com/coreos/go-oidc/oauth2"
20+
"github.com/gambol99/go-oidc/jose"
21+
"github.com/gambol99/go-oidc/oauth2"
2222
)
2323

2424
func TestProviderConfigDefaults(t *testing.T) {

oidc/transport.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"net/http"
66
"sync"
77

8-
phttp "github.com/coreos/go-oidc/http"
9-
"github.com/coreos/go-oidc/jose"
8+
phttp "github.com/gambol99/go-oidc/http"
9+
"github.com/gambol99/go-oidc/jose"
1010
)
1111

1212
type TokenRefresher interface {

oidc/transport_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"reflect"
77
"testing"
88

9-
"github.com/coreos/go-oidc/jose"
9+
"github.com/gambol99/go-oidc/jose"
1010
)
1111

1212
type staticTokenRefresher struct {

oidc/util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strings"
1212
"time"
1313

14-
"github.com/coreos/go-oidc/jose"
14+
"github.com/gambol99/go-oidc/jose"
1515
)
1616

1717
// RequestTokenExtractor funcs extract a raw encoded token from a request.

oidc/util_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/coreos/go-oidc/jose"
10+
"github.com/gambol99/go-oidc/jose"
1111
)
1212

1313
func TestCookieTokenExtractorInvalid(t *testing.T) {

0 commit comments

Comments
 (0)