This commit is contained in:
Daniel Ponte 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 {
User(UserID) *User
}
type authStore struct {
@ -48,3 +49,7 @@ func (a *Authenticator) newAuthStore(s storage.Store) (as *authStore, err error)
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) {
log.Debug().Interface("userdata", c.user.ProviderUserData()).Msg("getOrCreateUser")
panic("not implemented")
return &User{}, nil
u := a.store.User(c.UserID)
if u == nil {
return nil, errors.New("no such user)
}
return u, nil
}