storage/auth checkpoint
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
This commit is contained in:
parent
357382774a
commit
be7a54e7f4
@ -10,9 +10,9 @@ type AuthStorage struct {
|
||||
GetByID(ctx context.Context, id int64) (*User, error)
|
||||
GetByEmail(context.Context, string) (*User, error)
|
||||
GetByUsername(context.Context, string) (*User, error)
|
||||
Create(context.Context, *User) error // create a non-exported create function which does take in the tx
|
||||
CreateAndInvite(ctx context.Context, user *User, token string, exp time.Duration) error
|
||||
Activate(context.Context, string) error
|
||||
Create(context.Context, *User) error // create a non-exported create function which does take in the tx
|
||||
CreateAndInvite(ctx context.Context, user *User, token string, exp time.Duration) error // figure this out
|
||||
Activate(context.Context, string) error // what does this do?
|
||||
Delete(ctx context.Context, id int64) error
|
||||
|
||||
UpdateUserPass(ctx context.Context, user string, oldPassword string, newPass string) error
|
||||
@ -26,13 +26,13 @@ type AuthStorage struct {
|
||||
AddSession(ctx context.Context, userid int64) (token string, err error)
|
||||
CheckSession(ctx context.Context, token string) (valid bool, userid int64, err error) // should also extend it by the lifespan if near the end of the time. maybe a 5 min window at the end?
|
||||
RemoveSession(ctx context.Context, token string) error
|
||||
SetLifespan(ctx context.Context, token string, lf time.Time) error
|
||||
// SetLifespan(ctx context.Context, token string, lf time.Time) error
|
||||
}
|
||||
|
||||
CSRF interface {
|
||||
AddCSRF(ctx context.Context, sessionToken string) (csrftoken string, err error)
|
||||
CheckCSRF(ctx context.Context, sessionToken string, csrfToken string) (bool, error)
|
||||
RemoveCSRF(ctx context.Context, sessionToken string) error
|
||||
ValidCSRF(ctx context.Context, sessionToken string, csrfToken string) (bool, error)
|
||||
// CleanupCSRF()
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ type User struct {
|
||||
CreatedAt string `json:"created_at"`
|
||||
IsActive bool `json:"is_active"`
|
||||
Role Role `json:"role"`
|
||||
Groups []int64 `json:"groups"`
|
||||
}
|
||||
|
||||
type Password struct {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user