Support talking to multiple ORY Hydra deployments (#35)

This commit is contained in:
Paul Davis
2019-11-14 01:11:13 -07:00
committed by hackerman
parent c0bc5dffa5
commit 803c935b47
17 changed files with 404 additions and 51 deletions

View File

@ -11,8 +11,9 @@ import (
)
type Client struct {
HydraURL url.URL
HTTPClient *http.Client
HydraURL url.URL
HTTPClient *http.Client
ForwardedProto string
}
func (c *Client) GetOAuth2Client(id string) (*OAuth2ClientJSON, bool, error) {
@ -148,6 +149,10 @@ func (c *Client) newRequest(method, relativePath string, body interface{}) (*htt
return nil, err
}
if c.ForwardedProto != "" {
req.Header.Add("X-Forwarded-Proto", c.ForwardedProto)
}
if body != nil {
req.Header.Set("Content-Type", "application/json")
}

View File

@ -7,6 +7,7 @@ type OAuth2ClientJSON struct {
ClientID *string `json:"client_id,omitempty"`
Secret *string `json:"client_secret,omitempty"`
GrantTypes []string `json:"grant_types"`
RedirectURIs []string `json:"redirect_uris,omitempty"`
ResponseTypes []string `json:"response_types,omitempty"`
Scope string `json:"scope"`
Owner string `json:"owner"`