testhelpers

package
v0.0.0-...-5acab9f Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package testhelpers is for test code that needs to be imported across packages DO NOT use this in production code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuthPrincipalToGraphQLClientTest

func AddAuthPrincipalToGraphQLClientTest(principal authentication.ApplicationPrincipal) func(*client.Request)

AddAuthPrincipalToGraphQLClientTest returns a function to add an auth principal to a graphql client test

func AddAuthWithAllJobCodesToGraphQLClientTest

func AddAuthWithAllJobCodesToGraphQLClientTest(euaID string) func(*client.Request)

AddAuthWithAllJobCodesToGraphQLClientTest adds authentication for all job codes

func NewConfig

func NewConfig() *viper.Viper

NewConfig returns a global viper config for testing

func NewRequesterPrincipal

func NewRequesterPrincipal() authentication.Principal

NewRequesterPrincipal returns what represents an MINT user that is NOT empowered as a Reviewer

func NewReviewerPrincipal

func NewReviewerPrincipal() authentication.Principal

NewReviewerPrincipal returns what represents an MINT user that is empowered as a member of the ADMIN.

func OktaAccessToken

func OktaAccessToken(config *viper.Viper) (string, error)

OktaAccessToken is a thread safe config retrieval for an access token It only fetches a new token if it hasn't been set already

Types

type AuthnResponse

type AuthnResponse struct {
	StateToken   string   `json:"stateToken"`
	Status       string   `json:"status"`
	Embedded     Embedded `json:"_embedded"`
	SessionToken string   `json:"sessionToken"`
}

AuthnResponse is a response marshaled from Okta authn API

type Embedded

type Embedded struct {
	Factors []Factor `json:"factors"`
}

Embedded is part of the Okta authn response

type Factor

type Factor struct {
	ID       string     `json:"id"`
	Provider string     `json:"provider"`
	Link     FactorLink `json:"_links"`
}

Factor has a challenge factor for MFA

type FactorLink struct {
	Verify FactorLinkVerify `json:"verify"`
}

FactorLink is a wrapper for a challenge link

type FactorLinkVerify

type FactorLinkVerify struct {
	HREF string `json:"href"`
}

FactorLinkVerify is the challenge verification link

type SettableClock

type SettableClock struct {
	*clock.Mock
}

SettableClock is a mock clock that can be set

func (*SettableClock) Set

func (c *SettableClock) Set(now time.Time)

Set sets the clock's Now() to the given time

Jump to

Keyboard shortcuts

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