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/provider_test.go | |
parent | 019891ab8b6709b2e3fb6be83d111fb73ec2bd32 (diff) |
Remove the oauth_callback_url config option
Infer the redirect url from the request instead
Diffstat (limited to 'server/auth/provider_test.go')
-rw-r--r-- | server/auth/provider_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/server/auth/provider_test.go b/server/auth/provider_test.go new file mode 100644 index 0000000..e35dcea --- /dev/null +++ b/server/auth/provider_test.go @@ -0,0 +1,30 @@ +package auth + +import ( + "crypto/tls" + "net/http" + "testing" +) + +func TestHTTP(t *testing.T) { + want := "http://example.com/auth/callback" + r := &http.Request{ + Host: "example.com", + } + ret := Oauth2RedirectURL(r) + if want != ret { + t.Errorf("Wanted %s, got %s", want, ret) + } +} + +func TestHTTPS(t *testing.T) { + want := "https://example.com/auth/callback" + r := &http.Request{ + Host: "example.com", + TLS: &tls.ConnectionState{}, + } + ret := Oauth2RedirectURL(r) + if want != ret { + t.Errorf("Wanted %s, got %s", want, ret) + } +} |