refresh

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRefreshTokenPayloadLength = 64
	TokenDelimer                     = "/"
)

Variables

View Source
var (
	ErrorInvalidUserID   = errors.New("invalid user ID")
	ErrorInvalidClientID = errors.New("invalid client ID")

	ErrorInvalidToken = errors.New("invalid token")
)

Functions

func DefaultRefreshTokenGenerator

func DefaultRefreshTokenGenerator() ([]byte, error)

Types

type RefreshTokenGenerator

type RefreshTokenGenerator func() ([]byte, error)

func (RefreshTokenGenerator) Generate

func (g RefreshTokenGenerator) Generate() ([]byte, error)

type RefreshTokenRepo

type RefreshTokenRepo interface {
	// Create generates and returns a new refresh token for the given client-user pair.
	// On success the token will be return.
	Create(userID, clientID string) (string, error)

	// Verify verifies that a token belongs to the client, and returns the corresponding user ID.
	// Note that this assumes the client validation is currently done in the application layer,
	Verify(clientID, token string) (string, error)

	// Revoke deletes the refresh token if the token belongs to the given userID.
	Revoke(userID, token string) error
}

func NewRefreshTokenRepo

func NewRefreshTokenRepo() RefreshTokenRepo

NewRefreshTokenRepo returns an in-memory RefreshTokenRepo useful for development.

func NewRefreshTokenRepoWithTokenGenerator

func NewRefreshTokenRepoWithTokenGenerator(tokenGenerator RefreshTokenGenerator) RefreshTokenRepo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL