fix: jwt error return status 400 for invalid role (#4081)
This commit is contained in:
@@ -212,7 +212,7 @@ jwtaudroleclaims:
|
||||
- key: '.aud[1]' # succeeds the aud claims check, but fail when hits the db
|
||||
data:
|
||||
aud: [postgrest_test_author, postgrest_test_invalid]
|
||||
expected_status: 400
|
||||
expected_status: 401
|
||||
|
||||
invalidroleclaimkeys:
|
||||
- 'role.other'
|
||||
|
||||
+1
-2
@@ -96,8 +96,7 @@ def test_jwt_errors(defaultenv):
|
||||
|
||||
headers = jwtauthheader({"role": "not_existing"}, SECRET)
|
||||
response = postgrest.session.get("/", headers=headers)
|
||||
# TODO: Should this return 401?
|
||||
assert response.status_code == 400
|
||||
assert response.status_code == 401
|
||||
assert response.json()["message"] == 'role "not_existing" does not exist'
|
||||
|
||||
# -31 seconds, because we allow clock skew of 30 seconds
|
||||
|
||||
Reference in New Issue
Block a user