diff --git a/pkg/auth/store.go b/pkg/auth/store.go index 027a9c8..0c9374c 100644 --- a/pkg/auth/store.go +++ b/pkg/auth/store.go @@ -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] +} diff --git a/pkg/auth/user.go b/pkg/auth/user.go index 219e285..88226d4 100644 --- a/pkg/auth/user.go +++ b/pkg/auth/user.go @@ -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 }