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

Class OAuth2Code

tests/django/test_oauth2/models.py:104–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104class OAuth2Code(Model, AuthorizationCodeMixin):
105 user = ForeignKey(User, on_delete=CASCADE)
106 client_id = CharField(max_length=48, db_index=True)
107 code = CharField(max_length=120, unique=True, null=False)
108 redirect_uri = TextField(default="", null=True)
109 response_type = TextField(default="")
110 scope = TextField(default="", null=True)
111 auth_time = IntegerField(null=False, default=now_timestamp)
112
113 def is_expired(self):
114 return self.auth_time + 300 < time.time()
115
116 def get_redirect_uri(self):
117 return self.redirect_uri
118
119 def get_scope(self):
120 return self.scope or ""
121
122 def get_auth_time(self):
123 return self.auth_time
124
125
126class CodeGrantMixin:

Callers 2

Calls

no outgoing calls

Tested by 1