2020-03-01 21:55:56 +00:00
|
|
|
"""passbook oidc claim helpers"""
|
|
|
|
from typing import Any, Dict
|
|
|
|
|
|
|
|
from passbook.core.models import User
|
|
|
|
|
|
|
|
|
|
|
|
def userinfo(claims: Dict[str, Any], user: User) -> Dict[str, Any]:
|
|
|
|
"""Populate claims from userdata"""
|
|
|
|
claims["name"] = user.name
|
|
|
|
claims["given_name"] = user.name
|
|
|
|
claims["family_name"] = user.name
|
|
|
|
claims["email"] = user.email
|
2020-06-19 18:34:27 +01:00
|
|
|
claims["preferred_username"] = user.username
|
2020-03-01 21:55:56 +00:00
|
|
|
return claims
|