Add BuildTokenURLForSite for subdomain OAuth flows
Subdomain-based OAuth providers (e.g. Zendesk) authenticate against a per-customer host, <subdomain>.zendesk.com, for both the authorize and the token endpoint. The subdomain is known at initiate but, unlike Datadog's region, the provider does not echo it back on the callback, so it must survive the round-trip another way. Carry the chosen site on the HMAC-signed OAuth state (OAuth2State.Site) and add a BuildTokenURLForSite closure, symmetric with the existing BuildAuthURLForSite, that builds the token URL from it at callback time. The state is signed, so a tampered site is rejected before use; the closure still re-validates the format. Datadog's domain-echo path is unchanged and a provider sets at most one of the two closures. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -49,6 +49,7 @@ func (r *Registry) ApplyOAuth2Defaults(p string, redirectURI string, c *connecto
|
||||
c.RequiresPKCE = reg.RequiresPKCE
|
||||
c.BuildAuthURLForSite = reg.BuildAuthURLForSite
|
||||
c.BuildTokenURLForDomain = reg.BuildTokenURLForDomain
|
||||
c.BuildTokenURLForSite = reg.BuildTokenURLForSite
|
||||
|
||||
// Deep copy ExtraAuthParams so per-connector mutations (e.g.
|
||||
// incremental auth, scope overrides) cannot alias back into the
|
||||
|
||||
Reference in New Issue
Block a user