mirror of
https://git.freesoftwareextremist.com/bloat
synced 2024-12-23 09:20:44 +00:00
28 lines
603 B
Go
28 lines
603 B
Go
package model
|
|
|
|
import (
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrSessionNotFound = errors.New("session not found")
|
|
)
|
|
|
|
type Session struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
InstanceDomain string `json:"instance_domain"`
|
|
AccessToken string `json:"access_token"`
|
|
CSRFToken string `json:"csrf_token"`
|
|
Settings Settings `json:"settings"`
|
|
}
|
|
|
|
type SessionRepo interface {
|
|
Add(session Session) (err error)
|
|
Get(sessionID string) (session Session, err error)
|
|
Remove(sessionID string)
|
|
}
|
|
|
|
func (s Session) IsLoggedIn() bool {
|
|
return len(s.AccessToken) > 0
|
|
}
|