diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2017-02-04 23:55:31 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-02-09 12:49:37 +0000 |
commit | 44cb8512c9881687e091cca589a0adcb9f72fa7a (patch) | |
tree | 7696577468e3a7aae4f97e129729804817d2ee81 /server/auth/gitlab/gitlab.go | |
parent | 019891ab8b6709b2e3fb6be83d111fb73ec2bd32 (diff) |
Remove the oauth_callback_url config option
Infer the redirect url from the request instead
Diffstat (limited to 'server/auth/gitlab/gitlab.go')
-rw-r--r-- | server/auth/gitlab/gitlab.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/auth/gitlab/gitlab.go b/server/auth/gitlab/gitlab.go index f76b2e8..27edafa 100644 --- a/server/auth/gitlab/gitlab.go +++ b/server/auth/gitlab/gitlab.go @@ -2,6 +2,7 @@ package gitlab import ( "errors" + "net/http" "strconv" "github.com/nsheridan/cashier/server/auth" @@ -51,7 +52,6 @@ func New(c *config.Auth) (*Config, error) { config: &oauth2.Config{ ClientID: c.OauthClientID, ClientSecret: c.OauthClientSecret, - RedirectURL: c.OauthCallbackURL, Endpoint: oauth2.Endpoint{ AuthURL: siteURL + "oauth/authorize", TokenURL: siteURL + "oauth/token", @@ -110,7 +110,8 @@ func (c *Config) Revoke(token *oauth2.Token) error { } // StartSession retrieves an authentication endpoint from Gitlab. -func (c *Config) StartSession(state string) *auth.Session { +func (c *Config) StartSession(state string, r *http.Request) *auth.Session { + c.config.RedirectURL = auth.Oauth2RedirectURL(r) return &auth.Session{ AuthURL: c.config.AuthCodeURL(state), } |