auth
2014-09-01
Child:5bf0a5fd1d01
auth/grant.go
Add Grant type and GrantStore interface. Rough out a Grant type that will handle OAuth2 authorization grants that can be exchanged for access tokens. Rough out a GrantStore interface that will be used to retrieve and store grants.
| paddy@26 | 1 package auth |
| paddy@26 | 2 |
| paddy@26 | 3 import ( |
| paddy@26 | 4 "time" |
| paddy@26 | 5 |
| paddy@26 | 6 "secondbit.org/uuid" |
| paddy@26 | 7 ) |
| paddy@26 | 8 |
| paddy@26 | 9 type Grant struct { |
| paddy@26 | 10 Code string |
| paddy@26 | 11 Created time.Time |
| paddy@26 | 12 ExpiresIn int32 |
| paddy@26 | 13 ClientID uuid.ID |
| paddy@26 | 14 Scope string |
| paddy@26 | 15 RedirectURI string |
| paddy@26 | 16 State string |
| paddy@26 | 17 } |
| paddy@26 | 18 |
| paddy@26 | 19 type GrantStore interface { |
| paddy@26 | 20 GetGrant(code string) (Grant, error) |
| paddy@26 | 21 SaveGrant(grant Grant) error |
| paddy@26 | 22 DeleteGrant(id uuid.ID) error |
| paddy@26 | 23 } |