mirror of
https://github.com/volatiletech/authboss.git
synced 2025-01-24 05:17:10 +02:00
More changes
This commit is contained in:
parent
02e91bc0ad
commit
b9e2a62802
@ -1,6 +1,8 @@
|
||||
package authboss
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
@ -18,20 +20,18 @@ type mockStoredUser struct {
|
||||
|
||||
type mockStoreLoader map[string]mockUser
|
||||
|
||||
func (m mockStorer) Create(key string, attr Attributes) error {
|
||||
m[key] = attr
|
||||
func (m mockStoredUser) PutEmail(ctx context.Context, key string, email string) error {
|
||||
m.Email = email
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m mockStorer) Put(key string, attr Attributes) error {
|
||||
m[key] = attr
|
||||
return nil
|
||||
func (m mockStoredUser) PutUsername(ctx context.Context, key string, username string) error {
|
||||
return errors.New("not impl")
|
||||
}
|
||||
|
||||
func (m mockStorer) Get(key string) (result interface{}, err error) {
|
||||
return &mockUser{
|
||||
m[key]["email"].(string), m[key]["password"].(string),
|
||||
}, nil
|
||||
func (m mockStoredUser) PutPassword(ctx context.Context, key string, password string) error {
|
||||
m.Password = password
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m mockStorer) PutOAuth(uid, provider string, attr Attributes) error {
|
||||
|
@ -53,11 +53,7 @@ type Storer interface {
|
||||
GetUsername(ctx context.Context) (username string, err error)
|
||||
GetPassword(ctx context.Context) (password string, err error)
|
||||
|
||||
// Create the user with the state, this should throw errors if
|
||||
// it's created already.
|
||||
Create(ctx context.Context) error
|
||||
|
||||
// Save the state
|
||||
// Save the state.
|
||||
Save(ctx context.Context) error
|
||||
|
||||
// Load the state based on the properties that have been given (typically
|
||||
|
Loading…
x
Reference in New Issue
Block a user