summaryrefslogtreecommitdiff
path: root/internal/handlers/handler_verify_test.go
diff options
context:
space:
mode:
authorManuel Nuñez <10672208+mind-ar@users.noreply.github.com>2022-09-04 19:21:30 -0300
committerGitHub <noreply@github.com>2022-09-05 08:21:30 +1000
commitca85992ac6dabafd8410a8928c01ebb8edaf6d7c (patch)
tree8a7349f15cb3a603ca2eed97bb6a73bc1b262e02 /internal/handlers/handler_verify_test.go
parent6cc182de0827ef71ce69bc2f4ad4e0fb89a54bfa (diff)
fix(handlers): verify handler (#3956)
When an anonymous user tries to access a forbidden resource with no subject, we should response with 403. Fixes #3084
Diffstat (limited to 'internal/handlers/handler_verify_test.go')
-rw-r--r--internal/handlers/handler_verify_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/handlers/handler_verify_test.go b/internal/handlers/handler_verify_test.go
index 0472b5669..6ae6e2932 100644
--- a/internal/handlers/handler_verify_test.go
+++ b/internal/handlers/handler_verify_test.go
@@ -140,7 +140,7 @@ func TestShouldCheckAuthorizationMatching(t *testing.T) {
{"two_factor", authentication.OneFactor, NotAuthorized},
{"two_factor", authentication.TwoFactor, Authorized},
- {"deny", authentication.NotAuthenticated, NotAuthorized},
+ {"deny", authentication.NotAuthenticated, Forbidden},
{"deny", authentication.OneFactor, Forbidden},
{"deny", authentication.TwoFactor, Forbidden},
}
@@ -508,11 +508,12 @@ func (p Pair) String() string {
func TestShouldVerifyAuthorizationsUsingSessionCookie(t *testing.T) {
testCases := []Pair{
- {"https://test.example.com", "", nil, authentication.NotAuthenticated, 401},
+ // should apply default policy.
+ {"https://test.example.com", "", nil, authentication.NotAuthenticated, 403},
{"https://bypass.example.com", "", nil, authentication.NotAuthenticated, 200},
{"https://one-factor.example.com", "", nil, authentication.NotAuthenticated, 401},
{"https://two-factor.example.com", "", nil, authentication.NotAuthenticated, 401},
- {"https://deny.example.com", "", nil, authentication.NotAuthenticated, 401},
+ {"https://deny.example.com", "", nil, authentication.NotAuthenticated, 403},
{"https://test.example.com", "john", []string{"john.doe@example.com"}, authentication.OneFactor, 403},
{"https://bypass.example.com", "john", []string{"john.doe@example.com"}, authentication.OneFactor, 200},