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

Class User

tests/flask/test_oauth2/models.py:11–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class User(db.Model):
12 id = db.Column(db.Integer, primary_key=True)
13 username = db.Column(db.String(40), unique=True, nullable=False)
14
15 def get_user_id(self):
16 return self.id
17
18 def check_password(self, password):
19 return password != "wrong"
20
21 def generate_user_info(self, scopes=None):
22 profile = {
23 "sub": str(self.id),
24 "name": self.username,
25 "given_name": "Jane",
26 "family_name": "Doe",
27 "middle_name": "Middle",
28 "nickname": "Jany",
29 "preferred_username": "j.doe",
30 "profile": "https://resource.test/janedoe",
31 "picture": "https://resource.test/janedoe/me.jpg",
32 "website": "https://resource.test",
33 "email": "janedoe@example.com",
34 "email_verified": True,
35 "gender": "female",
36 "birthdate": "2000-12-01",
37 "zoneinfo": "Europe/Paris",
38 "locale": "fr-FR",
39 "phone_number": "+1 (425) 555-1212",
40 "phone_number_verified": False,
41 "address": {
42 "formatted": "742 Evergreen Terrace, Springfield",
43 "street_address": "742 Evergreen Terrace",
44 "locality": "Springfield",
45 "region": "Unknown",
46 "postal_code": "1245",
47 "country": "USA",
48 },
49 "updated_at": 1745315119,
50 }
51 return UserInfo(profile)
52
53
54class Client(db.Model, OAuth2ClientMixin):

Callers 7

userFunction · 0.70
userFunction · 0.50
userFunction · 0.50
userFunction · 0.50
userFunction · 0.50
userFunction · 0.50
userFunction · 0.50

Calls

no outgoing calls

Tested by 7

userFunction · 0.56
userFunction · 0.40
userFunction · 0.40
userFunction · 0.40
userFunction · 0.40
userFunction · 0.40
userFunction · 0.40