auth
auth/grant.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.
1 package auth
3 import (
4 "time"
6 "secondbit.org/uuid"
7 )
9 type Grant struct {
10 Code string
11 Created time.Time
12 ExpiresIn int32
13 ClientID uuid.ID
14 Scope string
15 RedirectURI string
16 State string
17 }
19 type GrantStore interface {
20 GetGrant(code string) (Grant, error)
21 SaveGrant(grant Grant) error
22 DeleteGrant(id uuid.ID) error
23 }