mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-11-22 12:53:15 +01:00
harden auth gateway
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from auth_gateway.models.auth import OIDCMethodModel
|
||||
from authlib.integrations.starlette_client import OAuth
|
||||
|
||||
from auth_gateway.models.auth import OIDCMethodModel
|
||||
|
||||
|
||||
@dataclass
|
||||
class OIDCIdentity:
|
||||
@@ -45,6 +46,9 @@ class OIDCService:
|
||||
if "userinfo" in token and isinstance(token["userinfo"], dict):
|
||||
claims.update(token["userinfo"])
|
||||
email = claims.get("email")
|
||||
# An email the provider did not verify can be set by the user, so it must not pass the allowlists
|
||||
if str(claims.get("email_verified", True)).lower() == "false":
|
||||
email = None
|
||||
subject = claims.get("sub")
|
||||
return OIDCIdentity(subject=subject, email=email, claims=claims)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user