token

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package token is used to manage the creation and validation of the credentials used for authenthication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckClaims

func CheckClaims(claims *TokenClaims) error

CheckClaims checks if all the required claims are present in the access token

Types

type AuthorizationPayload

type AuthorizationPayload struct {
	Permissions []Permissions `json:"permissions"`
}

AuthorizationPayload represents an authz payload in the rpt token

type Manager

type Manager interface {
	Locate(ctx context.Context) (uuid.UUID, error)
	ParseToken(ctx context.Context, tokenString string) (*TokenClaims, error)
	PublicKey(kid string) *rsa.PublicKey
	PublicKeys() []*rsa.PublicKey
	IsServiceAccount(ctx context.Context, serviceName string) bool
}

Manager generate and find auth token information

func NewManager

func NewManager(config tokenManagerConfiguration) (Manager, error)

NewManager returns a new token Manager for handling tokens

func NewManagerWithPublicKey

func NewManagerWithPublicKey(id string, key *rsa.PublicKey) Manager

NewManagerWithPublicKey returns a new token Manager for handling tokens with the only public key

func ReadManagerFromContext

func ReadManagerFromContext(ctx context.Context) (*Manager, error)

ReadManagerFromContext extracts the token manager from the context

type Permissions

type Permissions struct {
	ResourceSetName *string `json:"resource_set_name"`
	ResourceSetID   *string `json:"resource_set_id"`
}

Permissions represents a "permissions" in the AuthorizationPayload

type PublicKey

type PublicKey struct {
	KeyID string
	Key   *rsa.PublicKey
}

type TokenClaims

type TokenClaims struct {
	Name          string                `json:"name"`
	Username      string                `json:"preferred_username"`
	GivenName     string                `json:"given_name"`
	FamilyName    string                `json:"family_name"`
	Email         string                `json:"email"`
	Company       string                `json:"company"`
	SessionState  string                `json:"session_state"`
	Authorization *AuthorizationPayload `json:"authorization"`
	jwt.StandardClaims
}

TokenClaims represents access token claims

Jump to

Keyboard shortcuts

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