Add access token check to auth
This commit is contained in:
parent
8f53e8a967
commit
6a2b213787
4 changed files with 34 additions and 7 deletions
|
@ -2,6 +2,8 @@ package models
|
|||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gen"
|
||||
)
|
||||
|
||||
// AccessToken maps a unique token to one account.
|
||||
|
@ -18,3 +20,10 @@ type AccessToken struct {
|
|||
// at a point in the future this server should never reach
|
||||
ExpiresAt time.Time `gorm:"default:TIMESTAMP WITH TIME ZONE '9999-12-30 23:59:59+00'"`
|
||||
}
|
||||
|
||||
type IAccessToken interface {
|
||||
// Get the data for a token
|
||||
//
|
||||
// SELECT * FROM @@table WHERE token = @token
|
||||
GetTokenIfValid(token string) (*gen.T, error)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue