mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-01 09:50:33 +08:00
Error out if OIDC_CLIENT_SECRETS is not set in server config
This commit is contained in:
@@ -44,8 +44,7 @@ def _load_secrets():
|
||||
return
|
||||
|
||||
if not "OIDC_CLIENT_SECRETS" in app.config:
|
||||
log.warn("To support authorization, OIDC_CLIENT_SECRETS has to be set.")
|
||||
return
|
||||
raise Unauthorized("OIDC_CLIENT_SECRETS must be set in server config.")
|
||||
|
||||
secrets = _json_loads(open(app.config['OIDC_CLIENT_SECRETS'],
|
||||
'r').read())
|
||||
|
||||
@@ -67,3 +67,8 @@ class TestAuthModule(unittest.TestCase):
|
||||
with patch.dict('module_build_service.app.config', {'NO_AUTH': True}, clear=True):
|
||||
request = mock.MagicMock()
|
||||
eq_(module_build_service.auth.get_user(request), None)
|
||||
|
||||
@raises(module_build_service.errors.Unauthorized)
|
||||
def test_misconfiguring_oidc_client_secrets_should_be_failed(self):
|
||||
request = mock.MagicMock()
|
||||
module_build_service.auth.get_user(request)
|
||||
|
||||
Reference in New Issue
Block a user