MCPcopy
hub / github.com/authlib/authlib / UserInfo

Class UserInfo

authlib/oidc/core/claims.py:195–273  ·  view source on GitHub ↗

The standard claims of a UserInfo object. Defined per `Section 5.1`_. .. _`Section 5.1`: http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims

Source from the content-addressed store, hash-verified

193
194
195class UserInfo(dict):
196 """The standard claims of a UserInfo object. Defined per `Section 5.1`_.
197
198 .. _`Section 5.1`: http://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
199 """
200
201 #: registered claims that UserInfo supports
202 REGISTERED_CLAIMS = [
203 "sub",
204 "name",
205 "given_name",
206 "family_name",
207 "middle_name",
208 "nickname",
209 "preferred_username",
210 "profile",
211 "picture",
212 "website",
213 "email",
214 "email_verified",
215 "gender",
216 "birthdate",
217 "zoneinfo",
218 "locale",
219 "phone_number",
220 "phone_number_verified",
221 "address",
222 "updated_at",
223 ]
224
225 SCOPES_CLAIMS_MAPPING = {
226 "openid": ["sub"],
227 "profile": [
228 "name",
229 "family_name",
230 "given_name",
231 "middle_name",
232 "nickname",
233 "preferred_username",
234 "profile",
235 "picture",
236 "website",
237 "gender",
238 "birthdate",
239 "zoneinfo",
240 "locale",
241 "updated_at",
242 ],
243 "email": ["email", "email_verified"],
244 "address": ["address"],
245 "phone": ["phone_number", "phone_number_verified"],
246 }
247
248 def validate_locale(self):
249 """Validate the locale claim is a BCP 47 language tag."""
250 locale = self.get("locale")
251 if locale is not None and not is_valid_language_tag(locale):
252 raise ValueError('"locale" MUST be a BCP 47 language tag')

Callers 9

userinfoMethod · 0.90
parse_id_tokenMethod · 0.90
userinfoMethod · 0.90
parse_id_tokenMethod · 0.90
test_generate_id_tokenFunction · 0.90
generate_user_infoMethod · 0.90
filterMethod · 0.85

Calls

no outgoing calls

Tested by 3

test_generate_id_tokenFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…