tokens

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPrivateKeySpecified occurs when the private key was not set
	// and there was an attempt to create a token
	ErrNoPrivateKeySpecified = errors.New("private key is nil")
)

Functions

This section is empty.

Types

type Creator

type Creator interface {
	// CreateProjectAdmin creates a signed token that has admin permissions for the project.
	// Reference is passed as the JWT `amr` value
	CreateProjectAdmin(projectID string, reference string) (string, error)
	// Create creates a signed token that has no admin permissions.
	Create(reference string) (string, error)
}

Creator creates all kinds of signed tokens for the background tasks

func NewCreator

func NewCreator(issuer string, privateKey *rsa.PrivateKey, lifetime time.Duration) Creator

NewCreator creates a new token creator for tasks

type CreatorMock

type CreatorMock struct {
	Err       error
	ProjectID string
	Token     string
}

func (*CreatorMock) Create

func (m *CreatorMock) Create(reference string) (string, error)

func (*CreatorMock) CreateProjectAdmin

func (m *CreatorMock) CreateProjectAdmin(projectID string, reference string) (string, error)

Jump to

Keyboard shortcuts

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