auth

Paddy 2014-09-01 Parent:c50153e44821 Child:5bf0a5fd1d01

28:75cf37088852 Go to Latest

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.

History
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 }