diff options
Diffstat (limited to 'internal/oidc/util_blackbox_test.go')
| -rw-r--r-- | internal/oidc/util_blackbox_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/oidc/util_blackbox_test.go b/internal/oidc/util_blackbox_test.go index 3cafc5bf9..65b07f00a 100644 --- a/internal/oidc/util_blackbox_test.go +++ b/internal/oidc/util_blackbox_test.go @@ -55,6 +55,43 @@ func TestSortedJSONWebKey(t *testing.T) { } } +func TestRFC6750Header(t *testing.T) { + testCaes := []struct { + name string + have *fosite.RFC6749Error + realm string + scope string + expected string + }{ + { + "ShouldEncodeAll", + &fosite.RFC6749Error{ + ErrorField: "invalid_example", + DescriptionField: "A description", + }, + "abc", + "openid", + `realm="abc",error="invalid_example",error_description="A description",scope="openid"`, + }, + { + "ShouldEncodeBasic", + &fosite.RFC6749Error{ + ErrorField: "invalid_example", + DescriptionField: "A description", + }, + "", + "", + `error="invalid_example",error_description="A description"`, + }, + } + + for _, tc := range testCaes { + t.Run(tc.name, func(t *testing.T) { + assert.Equal(t, tc.expected, oidc.RFC6750Header(tc.realm, tc.scope, tc.have)) + }) + } +} + func TestIntrospectionResponseToMap(t *testing.T) { testCases := []struct { name string |
