-
Notifications
You must be signed in to change notification settings - Fork 219
fix(op): isolate provider endpoints and CORS options from package globals #927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,15 +269,17 @@ func NewProvider( | |
| NewAESCrypto(config.CryptoKey), | ||
| }, | ||
| ) | ||
| // Copied per provider: the options below assign into these and CORSOptions() hands its pointer to callers, so sharing the globals would let one provider reconfigure every other. | ||
| corsOpts := defaultCORSOptions | ||
| o := &Provider{ | ||
| config: config, | ||
| storage: storage, | ||
| accessTokenKeySet: keySet, | ||
| idTokenHinKeySet: keySet, | ||
| crypto: crypto, | ||
| endpoints: DefaultEndpoints, | ||
| endpoints: *DefaultEndpoints, | ||
| timer: make(<-chan time.Time), | ||
| corsOpts: &defaultCORSOptions, | ||
| corsOpts: &corsOpts, | ||
| } | ||
|
|
||
| for _, optFunc := range opOpts { | ||
|
|
@@ -302,7 +304,7 @@ type Provider struct { | |
| config *Config | ||
| issuer IssuerFromRequest | ||
| insecure bool | ||
| endpoints *Endpoints | ||
| endpoints Endpoints | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes the public contract and thus is a breaking change. We need to either keep it a pointer but copy the values, or merge this into next instead of main. |
||
| storage Storage | ||
| accessTokenKeySet oidc.KeySet | ||
| idTokenHinKeySet oidc.KeySet | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,12 +23,13 @@ func RegisterServer(server Server, endpoints Endpoints, options ...ServerOption) | |
| decoder := schema.NewDecoder() | ||
| decoder.IgnoreUnknownKeys(true) | ||
|
|
||
| corsOpts := defaultCORSOptions | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would like to see a copy/clone function for that so that this behavior is isolated. |
||
| ws := &webServer{ | ||
| router: chi.NewRouter(), | ||
| server: server, | ||
| endpoints: endpoints, | ||
| decoder: decoder, | ||
| corsOpts: &defaultCORSOptions, | ||
| corsOpts: &corsOpts, | ||
| } | ||
|
|
||
| for _, option := range options { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see a copy/clone function for that so that this behavior is isolated.