Support talking to multiple ORY Hydra deployments (#35)
This commit is contained in:
@ -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")
|
||||
}
|
||||
|
@ -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"`
|
||||
|
Reference in New Issue
Block a user