auth

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

31:88523dab00a5 Go to Latest

auth/profile.go

Implement ClientStore in Memstore. Add the ClientStore interface implementation to Memstore. Change the ClientStore interface's UpdateClient function to take a new type, ClientChange, rather than enumerating the arguments in the function signature, which is a much cleaner interface. Add tests for the successful (works-as-intended) scenarios involving ClientStores. Ignore UpdateClient for now--I want to do tests that test every combination of ClientUpdate attributes being specified, to be sure that only the attributes specified are updated and that all the attributes specified are updated.

History
paddy@27 1 package auth
paddy@27 2
paddy@27 3 import (
paddy@27 4 "time"
paddy@27 5
paddy@27 6 "secondbit.org/uuid"
paddy@27 7 )
paddy@27 8
paddy@27 9 type Profile struct {
paddy@27 10 ID uuid.ID
paddy@27 11 Name string
paddy@27 12 Passphrase string
paddy@27 13 Email string
paddy@27 14 Created time.Time
paddy@27 15 LastSeen time.Time
paddy@27 16 }
paddy@27 17
paddy@27 18 type Login struct {
paddy@27 19 Type string
paddy@27 20 Value string
paddy@27 21 ProfileID uuid.ID
paddy@27 22 Created time.Time
paddy@27 23 LastUsed time.Time
paddy@27 24 }
paddy@27 25
paddy@27 26 type ProfileStore interface {
paddy@27 27 GetProfileByID(id uuid.ID) (Profile, error)
paddy@27 28 GetProfileByLogin(loginType, value, passphrase string) (Profile, error)
paddy@27 29 SaveProfile(user Profile) error
paddy@27 30 UpdateProfile(id uuid.ID, name, passphrase, email *string) error
paddy@27 31 DeleteProfile(id uuid.ID) error
paddy@27 32
paddy@27 33 SaveLogin(login Login) error
paddy@27 34 DeleteLogin(login Login) error
paddy@27 35 UpdateLogin(id uuid.ID, lastUsed time.Time) error
paddy@27 36 }