auth

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

37:111382010276 Go to Latest

auth/profile.go

Additional tests, parallel test execution. Test that deleting a token that isn't in the token store returns an ErrTokenNotFound. Test that adding a token that already exists in the token store returns an ErrTokenAlreadyExists. Add t.Parallel() to make the test run in parallel.

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 }