ssoauthtest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ssoauthtest contains test helpers for SSO authentication.

Index

Constants

View Source
const (
	TimeFormat = "2006-01-02T15:04:05.000000"
)

Variables

This section is empty.

Functions

func Discharge

func Discharge(d *Discharger, root *macaroon.Macaroon, acc *ssoauth.Account, expires, validSince time.Time) (macaroon.Slice, error)

Discharge uses the given discharger to create a discharge macaroon for the given macaroon and binds that discharge to the original root macaroon. If acc, expires or validSince are non-zero then matching caveats will be added to the discharge macaroon to represent the given values.

func GetCaveatID

func GetCaveatID(d *Discharger, m *macaroon.Macaroon) ([]byte, error)

GetCaveatID gets the caveat ID of the third-party caveat in the given macaroon that is addressed to the given discharger. An error is returned if there is no caveat or if there is more than one such caveat.

Types

type Discharger

type Discharger struct {
	// contains filtered or unexported fields
}

func (*Discharger) Discharge

func (d *Discharger) Discharge(caveatID []byte, acc *ssoauth.Account, expires, validSince time.Time) (*macaroon.Macaroon, error)

Discharge creates a discharge macaroon for the given caveatID. If acc, expires or validSince are non-zero then matching caveats will be added to the discharge macaroon to represent the given values.

func (*Discharger) Location

func (d *Discharger) Location() string

Get the location of this discharger.

func (*Discharger) PublicKey

func (d *Discharger) PublicKey() *rsa.PublicKey

Get the public key for this discharger. The key is generated the first time it is requested.

Jump to

Keyboard shortcuts

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