cleanup oauth clients at startup

avoids leaving stale oauth clients in db

- cascade oauth access token, code deletion on delete of oauth client
This commit is contained in:
Min RK
2017-12-19 13:46:04 +01:00
parent 1b99b1275c
commit 7df8597484
2 changed files with 23 additions and 2 deletions

View File

@@ -408,7 +408,7 @@ class OAuthAccessToken(Hashed, Base):
__tablename__ = 'oauth_access_tokens'
id = Column(Integer, primary_key=True, autoincrement=True)
client_id = Column(Unicode(255))
client_id = Column(Unicode(255), ForeignKey('oauth_clients.identifier', ondelete='CASCADE'))
grant_type = Column(Enum(GrantType), nullable=False)
expires_at = Column(Integer)
refresh_token = Column(Unicode(255))
@@ -438,7 +438,7 @@ class OAuthAccessToken(Hashed, Base):
class OAuthCode(Base):
__tablename__ = 'oauth_codes'
id = Column(Integer, primary_key=True, autoincrement=True)
client_id = Column(Unicode(255))
client_id = Column(Unicode(255), ForeignKey('oauth_clients.identifier', ondelete='CASCADE'))
code = Column(Unicode(36))
expires_at = Column(Integer)
redirect_uri = Column(Unicode(1023))