git.iko.soy/typeable/oauth2-proxy
on master help sign in
Add unit test for protected resources
commit017b9bcfb7f387c44e158be02f6d405e66e07228 authorAlexander Block <ablock84@gmail.com> dateThu 10 Sep 2020, 10:30 (6 years ago) parent8cbf921
1 file changed+18
providers/provider_default_test.go+18
providers/provider_default_test.go+18
@@ -47,3 +47,21 @@ func TestAcrValuesConfigured(t *testing.T) {
4747 result := p.GetLoginURL("https://my.test.app/oauth", "")
4848 assert.Contains(t, result, "acr_values=testValue")
4949}
50+
51+func TestProtectedResourceConfigured(t *testing.T) {
52+ p := &ProviderData{
53+ LoginURL: &url.URL{
54+ Scheme: "http",
55+ Host: "my.test.idp",
56+ Path: "/oauth/authorize",
57+ },
58+ AcrValues: "testValue",
59+ ProtectedResource: &url.URL{
60+ Scheme: "http",
61+ Host: "my.resource.test",
62+ },
63+ }
64+
65+ result := p.GetLoginURL("https://my.test.app/oauth", "")
66+ assert.Contains(t, result, "resource="+url.QueryEscape("http://my.resource.test"))
67+}