37 lines
500 B
Go
37 lines
500 B
Go
|
package auth
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
|
||
|
"github.com/rs/zerolog/log"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
AuthKey = "auth"
|
||
|
)
|
||
|
|
||
|
type User struct {
|
||
|
Username string
|
||
|
UserMetadata
|
||
|
}
|
||
|
|
||
|
type UserMetadata struct {
|
||
|
Active bool
|
||
|
}
|
||
|
|
||
|
func (u *User) allowedToAuth() error {
|
||
|
if !u.Active {
|
||
|
return errors.New("user disabled")
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
func (a *Authenticator) getOrCreateUser(c *Credential) (*User, error) {
|
||
|
log.Debug().Str("user", c.user.ProviderUsername()).Msg("getOrCreateUser")
|
||
|
panic("not implemented")
|
||
|
return &User{}, nil
|
||
|
}
|
||
|
|
||
|
|