~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/types/oauth2grant.py -rw-r--r-- 629 bytes
72548bd7Drew DeVault API: Updates per core-go auth changes 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from srht.database import Base
import sqlalchemy as sa

class OAuth2Grant(Base):
    __tablename__ = 'oauth2_grant'
    id = sa.Column(sa.Integer, primary_key=True)
    issued = sa.Column(sa.DateTime, nullable=False)
    expires = sa.Column(sa.DateTime, nullable=False)
    comment = sa.Column(sa.Unicode)
    grants = sa.Column(sa.Unicode)

    token_hash = sa.Column(sa.String(128), nullable=False)

    user_id = sa.Column(sa.Integer,
            sa.ForeignKey("user.id", ondelete="CASCADE"),
            nullable=False)
    client_id = sa.Column(sa.Integer,
            sa.ForeignKey("oauth2_client.id", ondelete="CASCADE"))