tokenkey

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2016 License: MIT Imports: 6 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	Get(server string, renew bool) (*TokenKey, error)
	Update() error
}

Provider represents a provider of the token key

func ConstProvider

func ConstProvider(key, algorithm string) Provider

ConstProvider creates Provider that always resturns the same TokenKey

func FuncProvider

func FuncProvider(funcs map[string]TokenFunc) Provider

FuncProvider creates Provider that executes a function which resturns a tokenkey

func HTTPProvider

func HTTPProvider(servers map[string]string, cache cache.Cache) Provider

HTTPProvider returns a new Provider that fetches the key from a HTTP resource

type TokenFunc

type TokenFunc func(renew bool) (*TokenKey, error)

TokenFunc returns a tokenKey and optionally renews it

type TokenKey

type TokenKey struct {
	Algorithm string `json:"algorithm"`
	Key       string `json:"key"`
}

TokenKey is the data returned by the token key provider

Jump to

Keyboard shortcuts

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