tokens

package
v0.0.0-...-6d4a0cd Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTokenService

func NewTokenService(store Cache, generator TokenGenerator) *tokenService

Types

type Cache

type Cache interface {
	Put(token string, data TokenData)
	Get(token string) (TokenData, apperrors.AppError)
	Delete(token string)
}

func NewTokenCache

func NewTokenCache(applicationTokenTTL, runtimeTokenTTL, csrTokenTTL time.Duration) Cache

type Service

type Service interface {
	CreateToken(clientId string, tokenType TokenType) (string, apperrors.AppError)
	Resolve(token string) (TokenData, apperrors.AppError)
	Delete(token string)
}

type TokenData

type TokenData struct {
	Type     TokenType
	ClientId string
}

type TokenGenerator

type TokenGenerator interface {
	NewToken() (string, apperrors.AppError)
}

func NewTokenGenerator

func NewTokenGenerator(tokenLength int) TokenGenerator

type TokenType

type TokenType string
const (
	ApplicationToken TokenType = "Application"
	RuntimeToken     TokenType = "Runtime"
	CSRToken         TokenType = "Certificate"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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