MCPcopy
hub / github.com/authlib/authlib / generate_user_info

Method generate_user_info

authlib/oidc/core/grants/code.py:41–58  ·  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

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

Callers 1

encode_id_tokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected