pathbtest

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pathbtest helps tests drive steward's authorization server end to end: a fake Google sign-in, a browser that approves the consent page, and helpers that obtain access tokens over HTTP. Test-only; nothing here is part of steward's API.

Index

Constants

View Source
const ClientRedirect = "http://127.0.0.1:1/callback"

ClientRedirect is the redirect URI test clients register; it is never dialed.

View Source
const RobotSA = "robot@test-project.iam.gserviceaccount.com"

RobotSA is a service account for client-credentials tests.

View Source
const SignInClientID = "steward-signin.apps.googleusercontent.com"

SignInClientID is the Google client ID the fake sign-in issues ID tokens for.

Variables

This section is empty.

Functions

func Browser

Browser returns an MCP SDK AuthorizationCodeFetcher that follows redirects like a user's browser, approving the consent page, until it reaches the client's redirect URI.

func ClientCredentials

func ClientCredentials(t testing.TB, issuer, id, secret string) string

ClientCredentials returns a workload's access token.

func PersonToken

func PersonToken(t testing.TB, issuer, resource, scope string) string

PersonToken registers a client by DCR with the authorization server at issuer, signs the fake's person in for resource with the given scope (empty: none asked for), and returns the access token.

func Token

func Token(t testing.TB, issuer string, form url.Values, id, secret string) string

Token posts form to the token endpoint (with Basic credentials if id is set) and returns the access token.

Types

type Person

type Person struct {
	Sub, Email, HD string
}

Person is who the fake signs in.

type ServiceTokens

type ServiceTokens struct{}

ServiceTokens is an authserver.ServiceTokens that mints "ya29.sa-<account>" for any service account.

func (ServiceTokens) Token

Token implements authserver.ServiceTokens.

type SignIn

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

SignIn is Google's sign-in and token endpoints, signing everyone in as one Person, with the cloud-platform scope and a refresh token.

func NewSignIn

func NewSignIn(t testing.TB, as Person) *SignIn

NewSignIn starts the fake.

func (*SignIn) Google

func (f *SignIn) Google() authserver.GoogleClient

Google is the GoogleClient to configure the authorization server with.

func (*SignIn) Minted

func (f *SignIn) Minted() []string

Minted lists every Google access token handed out.

Jump to

Keyboard shortcuts

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