Skip to content

Commit 6649042

Browse files
awesthousesebastianvitterso
authored andcommitted
fix: allow auth disabled -> default to default_user
1 parent 930c66c commit 6649042

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

api/src/authentication/authentication.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from authentication.models import User
88
from common.exceptions import UnauthorizedException
99
from common.logger import logger
10-
from config import config
10+
from config import config, default_user
1111

1212
oauth2_scheme = OAuth2AuthorizationCodeBearer(
1313
authorizationUrl=config.OAUTH_AUTH_ENDPOINT,
@@ -29,6 +29,8 @@ def get_JWK_client() -> jwt.PyJWKClient:
2929

3030

3131
def auth_with_jwt(jwt_token: str = Security(oauth2_scheme)) -> User:
32+
if not config.AUTH_ENABLED:
33+
return default_user
3234
if not jwt_token:
3335
raise UnauthorizedException
3436
key = get_JWK_client().get_signing_key_from_jwt(jwt_token).key

0 commit comments

Comments
 (0)