auth
auth/profile.go
Rough out tokens and begin the memstore. Rough out the Token type for working with OAuth2 access and refresh tokens. Rough out the TokenStore interface that dictates how Tokens will be stored and retrieved. Write tests for the successful (in the working-as-intended sense) calls to TokenStore. Begin a Memstore type that stores data in memory. Implement the TokenStore interface for Memstore.
1 package auth
3 import (
4 "time"
6 "secondbit.org/uuid"
7 )
9 type Profile struct {
10 ID uuid.ID
11 Name string
12 Passphrase string
13 Email string
14 Created time.Time
15 LastSeen time.Time
16 }
18 type Login struct {
19 Type string
20 Value string
21 ProfileID uuid.ID
22 Created time.Time
23 LastUsed time.Time
24 }
26 type ProfileStore interface {
27 GetProfileByID(id uuid.ID) (Profile, error)
28 GetProfileByLogin(loginType, value, passphrase string) (Profile, error)
29 SaveProfile(user Profile) error
30 UpdateProfile(id uuid.ID, name, passphrase, email *string) error
31 DeleteProfile(id uuid.ID) error
33 SaveLogin(login Login) error
34 DeleteLogin(login Login) error
35 UpdateLogin(id uuid.ID, lastUsed time.Time) error
36 }