File: models.py

package info (click to toggle)
python-authlib 1.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,016 kB
  • sloc: python: 26,998; makefile: 53; sh: 14
file content (38 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import time


class DeviceCredentialMixin:
    def get_client_id(self):
        raise NotImplementedError()

    def get_scope(self):
        raise NotImplementedError()

    def get_user_code(self):
        raise NotImplementedError()

    def is_expired(self):
        raise NotImplementedError()


class DeviceCredentialDict(dict, DeviceCredentialMixin):
    def get_client_id(self):
        return self["client_id"]

    def get_scope(self):
        return self.get("scope")

    def get_user_code(self):
        return self["user_code"]

    def get_nonce(self):
        return self.get("nonce")

    def get_auth_time(self):
        return self.get("auth_time")

    def is_expired(self):
        expires_at = self.get("expires_at")
        if expires_at:
            return expires_at < time.time()
        return False