Add unit test for protected resources

This commit is contained in:
Alexander Block 2020-09-10 10:30:05 +02:00
parent 8cbf9219bc
commit 017b9bcfb7

View File

@ -47,3 +47,21 @@ func TestAcrValuesConfigured(t *testing.T) {
result := p.GetLoginURL("https://my.test.app/oauth", "") result := p.GetLoginURL("https://my.test.app/oauth", "")
assert.Contains(t, result, "acr_values=testValue") assert.Contains(t, result, "acr_values=testValue")
} }
func TestProtectedResourceConfigured(t *testing.T) {
p := &ProviderData{
LoginURL: &url.URL{
Scheme: "http",
Host: "my.test.idp",
Path: "/oauth/authorize",
},
AcrValues: "testValue",
ProtectedResource: &url.URL{
Scheme: "http",
Host: "my.resource.test",
},
}
result := p.GetLoginURL("https://my.test.app/oauth", "")
assert.Contains(t, result, "resource="+url.QueryEscape("http://my.resource.test"))
}