This commit is contained in:
Daniel 2022-11-12 17:50:01 -05:00
parent a540f94108
commit 9f39049dd6
2 changed files with 11 additions and 2 deletions

View file

@ -12,6 +12,7 @@ const (
) )
type AuthStore interface { type AuthStore interface {
User(UserID) *User
} }
type authStore struct { type authStore struct {
@ -48,3 +49,7 @@ func (a *Authenticator) newAuthStore(s storage.Store) (as *authStore, err error)
return return
} }
func (s *authStore) User(uid UserID) *User {
return s.userMap[uid]
}

View file

@ -35,6 +35,10 @@ func (u *User) allowedToAuth() error {
func (a *Authenticator) getOrCreateUser(c *Credential) (*User, error) { func (a *Authenticator) getOrCreateUser(c *Credential) (*User, error) {
log.Debug().Interface("userdata", c.user.ProviderUserData()).Msg("getOrCreateUser") log.Debug().Interface("userdata", c.user.ProviderUserData()).Msg("getOrCreateUser")
panic("not implemented") u := a.store.User(c.UserID)
return &User{}, nil if u == nil {
return nil, errors.New("no such user)
}
return u, nil
} }