auth
2014-09-01
Parent:9fe684b33b3d
auth/storage.go
Deprecate old implementations. Let's remove all of the osin stuff altogether, in favour of a more testable, unit-based approach. Leave all the old files around, for easy reference, but add the .old suffix so the go tools don't pick them up.
| paddy@6 | 1 package auth |
| paddy@0 | 2 |
| paddy@1 | 3 import "secondbit.org/uuid" |
| paddy@0 | 4 |
| paddy@1 | 5 type ClientStore interface { |
| paddy@1 | 6 GetClient(id uuid.ID) (Client, error) |
| paddy@1 | 7 CreateClient(name, logo, redirectURI string, owner uuid.ID) (Client, error) |
| paddy@12 | 8 UpdateClient(client uuid.ID, name, logo, redirectURI *string) error |
| paddy@15 | 9 RemoveClient(id uuid.ID) error |
| paddy@12 | 10 ListClients(id uuid.ID, page, num int) ([]Client, error) |
| paddy@1 | 11 } |
| paddy@0 | 12 |
| paddy@1 | 13 type TokenStore interface { |
| paddy@1 | 14 SaveAuthorization(AuthorizeData) error |
| paddy@1 | 15 GetAuthorization(code string) (AuthorizeData, error) |
| paddy@1 | 16 RemoveAuthorization(code string) error |
| paddy@0 | 17 |
| paddy@1 | 18 SaveAccess(AccessData) error |
| paddy@1 | 19 GetAccess(token string) (AccessData, error) |
| paddy@0 | 20 RemoveAccess(token string) error |
| paddy@0 | 21 |
| paddy@1 | 22 GetRefresh(token string) (AccessData, error) |
| paddy@0 | 23 RemoveRefresh(token string) error |
| paddy@0 | 24 } |
| paddy@1 | 25 |
| paddy@1 | 26 type ProfileStore interface { |
| paddy@1 | 27 GetProfile(username, password string) (uuid.ID, error) |
| paddy@1 | 28 } |
| paddy@19 | 29 |
| paddy@19 | 30 type SessionStore interface { |
| paddy@19 | 31 GetSession(token string) (Session, error) |
| paddy@19 | 32 GetAllSessions(username string) ([]Session, error) |
| paddy@19 | 33 SetSession(Session) error |
| paddy@19 | 34 ExpireSession(token string) error |
| paddy@19 | 35 } |