auth

Paddy 2014-09-01 Child:5bf0a5fd1d01

26:c50153e44821 Go to Latest

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.

History
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/grant.go	Mon Sep 01 09:17:08 2014 -0400
     1.3 @@ -0,0 +1,23 @@
     1.4 +package auth
     1.5 +
     1.6 +import (
     1.7 +	"time"
     1.8 +
     1.9 +	"secondbit.org/uuid"
    1.10 +)
    1.11 +
    1.12 +type Grant struct {
    1.13 +	Code        string
    1.14 +	Created     time.Time
    1.15 +	ExpiresIn   int32
    1.16 +	ClientID    uuid.ID
    1.17 +	Scope       string
    1.18 +	RedirectURI string
    1.19 +	State       string
    1.20 +}
    1.21 +
    1.22 +type GrantStore interface {
    1.23 +	GetGrant(code string) (Grant, error)
    1.24 +	SaveGrant(grant Grant) error
    1.25 +	DeleteGrant(id uuid.ID) error
    1.26 +}