@@ -16,6 +16,7 @@ import (
16
16
"strings"
17
17
"time"
18
18
19
+ brickstransport "github.com/pace/bricks/http/transport"
19
20
"golang.org/x/oauth2"
20
21
jose "gopkg.in/square/go-jose.v2"
21
22
)
@@ -60,6 +61,7 @@ func doRequest(ctx context.Context, req *http.Request) (*http.Response, error) {
60
61
if c , ok := ctx .Value (oauth2 .HTTPClient ).(* http.Client ); ok {
61
62
client = c
62
63
}
64
+ client .Transport = brickstransport .NewDefaultTransportChain ()
63
65
return client .Do (req .WithContext (ctx ))
64
66
}
65
67
@@ -110,7 +112,7 @@ var supportedAlgorithms = map[string]bool{
110
112
//
111
113
// The issuer is the URL identifier for the service. For example: "https://accounts.google.com"
112
114
// or "https://login.salesforce.com".
113
- func NewProvider (ctx context.Context , issuer string ) (* Provider , error ) {
115
+ func NewProvider (ctx context.Context , issuer string , alternativeIssuer ... string ) (* Provider , error ) {
114
116
wellKnown := strings .TrimSuffix (issuer , "/" ) + "/.well-known/openid-configuration"
115
117
req , err := http .NewRequest ("GET" , wellKnown , nil )
116
118
if err != nil {
@@ -137,8 +139,10 @@ func NewProvider(ctx context.Context, issuer string) (*Provider, error) {
137
139
return nil , fmt .Errorf ("oidc: failed to decode provider discovery object: %v" , err )
138
140
}
139
141
140
- if p .Issuer != issuer {
141
- return nil , fmt .Errorf ("oidc: issuer did not match the issuer returned by provider, expected %q got %q" , issuer , p .Issuer )
142
+ alternativeIssuer = append (alternativeIssuer , issuer )
143
+ issuerStr := strings .Join (alternativeIssuer , " " )
144
+ if ! strings .Contains (issuerStr , p .Issuer ) {
145
+ return nil , fmt .Errorf ("oidc: issuer did not match the issuer returned by provider, expected one of %q got %q" , issuerStr , p .Issuer )
142
146
}
143
147
var algs []string
144
148
for _ , a := range p .Algorithms {
0 commit comments