MCPcopy Create free account
hub / github.com/authlib/authlib / generate_user_info

Method generate_user_info

authlib/oidc/core/grants/code.py:43–60  ·  view source on GitHub ↗

Provide user information for the given scope. Developers MUST implement this method in subclass, e.g.:: from authlib.oidc.core import UserInfo def generate_user_info(self, user, scope): user_info = UserInfo(sub=user.id, name=user.name)

(self, user, scope)

Source from the content-addressed store, hash-verified

41 return claims
42
43 def generate_user_info(self, user, scope):
44 """Provide user information for the given scope. Developers
45 MUST implement this method in subclass, e.g.::
46
47 from authlib.oidc.core import UserInfo
48
49
50 def generate_user_info(self, user, scope):
51 user_info = UserInfo(sub=user.id, name=user.name)
52 if "email" in scope:
53 user_info["email"] = user.email
54 return user_info
55
56 :param user: user instance
57 :param scope: scope of the token
58 :return: ``authlib.oidc.core.UserInfo`` instance
59 """
60 raise NotImplementedError()
61
62 def encode_id_token(self, token, request: OAuth2Request):
63 alg = self.get_client_algorithm(request.client)

Callers 1

encode_id_tokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected