token

package
v0.0.0-...-2b3a616 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeypair

func GenerateKeypair(filename string) (err error)

GenerateKeypair generates a public and private ECDSA key, to be used for signing and verifying authentication tokens.

Types

type AuthToken

type AuthToken struct {
	Username   string
	Assertions map[string]string
}

AuthToken contains information about the authenticated user

type Signer

type Signer interface {
	// Sign a token and return the serialized cryptographic token.
	Sign(token *AuthToken) (string, error)
}

Signer signs an issued token

func NewSigner

func NewSigner(filename string) (Signer, error)

NewSigner is, for the moment, a thin wrapper around Square's go-jose library to issue ECDSA-P256 JWS tokens.

type Verifier

type Verifier interface {
	// Verify the payload and return the Token if the payload is valid.
	Verify(s string) (token *AuthToken, err error)
}

Verifier verifies the serialized representation of a token

func NewVerifier

func NewVerifier(basename string) (Verifier, error)

NewVerifier reads a verification key file, and returns a verifier to verify token objects.

Jump to

Keyboard shortcuts

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