auth

Paddy 2014-09-07 Parent:043906283c65 Child:1f7b44b130a0

35:d89740a34654 Go to Latest

auth/profile.go

Fix token tests. Use the %T format to return the name of the TokenStore that failed tests, instead of just returning the position. Compare the fields of the tokens retrieved against the expected fields.

History
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 }