auth

Paddy 2014-09-01 Parent:9fc5fd8196b4 Child:88523dab00a5

28:75cf37088852 Go to Latest

auth/client.go

Rough out tokens and begin the memstore. Rough out the Token type for working with OAuth2 access and refresh tokens. Rough out the TokenStore interface that dictates how Tokens will be stored and retrieved. Write tests for the successful (in the working-as-intended sense) calls to TokenStore. Begin a Memstore type that stores data in memory. Implement the TokenStore interface for Memstore.

History
1 package auth
3 import (
4 "secondbit.org/uuid"
5 )
7 // Client represents a client that grants access
8 // to the auth server, exchanging grants for tokens,
9 // and tokens for access.
10 type Client struct {
11 ID uuid.ID
12 Secret string
13 RedirectURI string
14 OwnerID uuid.ID
15 Name string
16 Logo string
17 Website string
18 }
20 // ClientStore abstracts the storage interface for
21 // storing and retrieving Clients.
22 type ClientStore interface {
23 GetClient(id uuid.ID) (Client, error)
24 SaveClient(client Client) error
25 UpdateClient(id uuid.ID, secret, redirectURI *string, ownerID uuid.ID, name, logo, website *string) error
26 DeleteClient(id uuid.ID) error
27 ListClientsByOwner(ownerID uuid.ID, page, num int) ([]Client, error)
28 }