-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#94): remove admin header check
the room service does not handle highly sensitive data, so we can remove this crutch here even though the idp does not yet enforce 2FA.
- Loading branch information
1 parent
940f297
commit 7799bce
Showing
4 changed files
with
1 addition
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,6 @@ func TestNewRBACValidator(t *testing.T) { | |
inputJWT string | ||
inputAPIKey string | ||
inputClaims *common.AllClaims | ||
includeAdminHeader bool | ||
customAdminHeaderValue string | ||
} | ||
|
||
|
@@ -72,67 +71,13 @@ func TestNewRBACValidator(t *testing.T) { | |
EMail: "[email protected]", | ||
}, | ||
}, | ||
includeAdminHeader: true, | ||
}, | ||
expected: expected{ | ||
isAdmin: true, | ||
subject: "123456", | ||
roles: []string{"admin", "test"}, | ||
}, | ||
}, | ||
// TODO remove test case after 2FA is available | ||
// See reference https://github.com/eurofurence/reg-payment-service/issues/57 | ||
{ | ||
name: "Should not create manager with admin role when no admin header is set", | ||
args: args{ | ||
inputJWT: "valid", | ||
inputAPIKey: "", | ||
inputClaims: &common.AllClaims{ | ||
RegisteredClaims: jwt.RegisteredClaims{ | ||
Subject: "123456", | ||
}, | ||
CustomClaims: common.CustomClaims{ | ||
Groups: []string{"admin", "test"}, | ||
Name: "Peter", | ||
EMail: "[email protected]", | ||
}, | ||
}, | ||
includeAdminHeader: false, | ||
}, | ||
expected: expected{ | ||
isAdmin: false, | ||
isRegisteredUser: true, | ||
subject: "123456", | ||
roles: []string{"admin", "test"}, | ||
}, | ||
}, | ||
// TODO remove test case after 2FA is available | ||
// See reference https://github.com/eurofurence/reg-payment-service/issues/57 | ||
{ | ||
name: "Should not create manager with admin role when no valid admin header is set", | ||
args: args{ | ||
inputJWT: "valid", | ||
inputAPIKey: "", | ||
inputClaims: &common.AllClaims{ | ||
RegisteredClaims: jwt.RegisteredClaims{ | ||
Subject: "123456", | ||
}, | ||
CustomClaims: common.CustomClaims{ | ||
Groups: []string{"admin", "test"}, | ||
Name: "Peter", | ||
EMail: "[email protected]", | ||
}, | ||
}, | ||
includeAdminHeader: true, | ||
customAdminHeaderValue: "test-12345", | ||
}, | ||
expected: expected{ | ||
isAdmin: false, | ||
isRegisteredUser: true, | ||
subject: "123456", | ||
roles: []string{"admin", "test"}, | ||
}, | ||
}, | ||
{ | ||
name: "Should create manager with registered user role", | ||
args: args{ | ||
|
@@ -218,9 +163,6 @@ func TestNewRBACValidator(t *testing.T) { | |
|
||
if tt.args.inputClaims != nil { | ||
ctx = context.WithValue(ctx, common.CtxKeyClaims{}, tt.args.inputClaims) | ||
if tt.args.includeAdminHeader { | ||
ctx = context.WithValue(ctx, common.CtxKeyAdminHeader{}, coalesce(tt.args.customAdminHeaderValue, "available")) | ||
} | ||
} | ||
|
||
mgr, err := NewValidator(ctx) | ||
|