Skip to content

Commit

Permalink
api: only set auth_via when actually authenticating via token
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
  • Loading branch information
BeryJu committed Apr 4, 2022
1 parent 497db3d commit 9f7ab09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion authentik/api/authentication.py
Expand Up @@ -38,12 +38,12 @@ def bearer_auth(raw_header: bytes) -> Optional[User]:
return None
if not hasattr(LOCAL, "authentik"):
LOCAL.authentik = {}
LOCAL.authentik[KEY_AUTH_VIA] = "api_token"
# first, check traditional tokens
key_token = Token.filter_not_expired(
key=auth_credentials, intent=TokenIntents.INTENT_API
).first()
if key_token:
LOCAL.authentik[KEY_AUTH_VIA] = "api_token"
return key_token.user
# then try to auth via JWT
jwt_token = RefreshToken.filter_not_expired(
Expand Down

0 comments on commit 9f7ab09

Please sign in to comment.