From 017b9bcfb7f387c44e158be02f6d405e66e07228 Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Thu, 10 Sep 2020 10:30:05 +0200 Subject: [PATCH] Add unit test for protected resources --- providers/provider_default_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/providers/provider_default_test.go b/providers/provider_default_test.go index 74d7096f..e699a68e 100644 --- a/providers/provider_default_test.go +++ b/providers/provider_default_test.go @@ -47,3 +47,21 @@ func TestAcrValuesConfigured(t *testing.T) { result := p.GetLoginURL("https://my.test.app/oauth", "") 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")) +}