123456789101112131415161718192021222324252627282930313233343536 |
- package accounts
- type User struct {
- Username string
- IsAdmin bool
- }
- func (u User) IsEmpty() bool {
- return u.Username == ""
- }
- type AuthenticationSource int
- const (
- Header AuthenticationSource = iota
- Cookie
- )
- type Authentication struct {
- Token string
- Source AuthenticationSource
- CsrfToken string
- }
- type AuthError struct {
- Err error
- }
- func (e AuthError) Error() string {
- return "Auth error: " + e.Err.Error()
- }
- func (e AuthError) Unwrap() error {
- return e.Err
- }
|