Skip to content

Commit

Permalink
fleshing out token auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Townsend committed Oct 29, 2019
1 parent 9e0e715 commit 0e3dd9d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions piccolo_api/token_auth/tables/token_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import secrets

from piccolo.columns.column_types import Varchar, ForeignKey
from piccolo.extensions.user import BaseUser
from piccolo.table import Table


class TokenAuth(Table):
"""
Holds randomly generated tokens.
Useful for mobile authentication, IOT etc. Session auth is recommended for
web usage.
"""
token = Varchar()
user = ForeignKey(references=BaseUser)

@classmethod
def create_token(user_id: int):
pass

0 comments on commit 0e3dd9d

Please sign in to comment.