Skip to content

Commit 141e2df

Browse files
committed
Split out token validation
Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
1 parent d640e6f commit 141e2df

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

flask_oidc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ def decorated(*args, **kwargs):
716716
token = request.args['access_token']
717717

718718
validity = self.validate_token(token, scopes_required)
719-
if (validity is True) or not require_token:
719+
if (validity is True) or (not require_token):
720720
return view_func(*args, **kwargs)
721721
else:
722722
return (json.dumps(

tests/test_flask_oidc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,7 @@ def test_api_token():
196196

197197
# Test with token for another audience
198198
resp = test_client.get('/api?access_token=some_elses_token')
199+
assert resp.status_code == 200, 'Token should be accepted'
200+
test_client.application.config['OIDC_RESOURCE_CHECK_AUD'] = True
201+
resp = test_client.get('/api?access_token=some_elses_token')
199202
assert resp.status_code == 401, 'Token should be refused'

0 commit comments

Comments
 (0)