diff --git a/app/auth.py b/app/auth.py index fbced09..a36b1d6 100644 --- a/app/auth.py +++ b/app/auth.py @@ -101,9 +101,9 @@ async def exchange_token(user_token: str, url: str) -> str: provider = settings.backend_auth_config[url].token_provider token_prefix = settings.backend_auth_config[url].token_prefix - if not provider or not token_prefix: + if not provider: raise ValueError( - f"Backend '{url}' must define 'token_provider' and 'token_prefix'" + f"Backend '{url}' must define 'token_provider'" ) platform_token = await _exchange_token_for_provider( diff --git a/tests/test_auth.py b/tests/test_auth.py index 5fb9805..881fe3b 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -32,27 +32,6 @@ async def test_exchange_token_missing_provider(): settings.backend_auth_config[url] = original_config -@pytest.mark.asyncio -async def test_exchange_token_missing_token_prefix(): - url = "https://openeo.vito.be" - original_config = settings.backend_auth_config.get(url) - - try: - # Create a config without token_prefix - settings.backend_auth_config[url] = BackendAuthConfig( - auth_method=AuthMethod.USER_CREDENTIALS, - token_provider="openeo", - token_prefix=None, - ) - - with pytest.raises(ValueError, match="must define"): - await exchange_token("user-token", url) - finally: - # Restore original config - if original_config: - settings.backend_auth_config[url] = original_config - - @pytest.mark.asyncio @patch( "app.auth._exchange_token_for_provider",