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
| 193 | |
| 194 | |
| 195 | class 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') |
no outgoing calls
searching dependent graphs…