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
- func Browser() auth.AuthorizationCodeFetcher
- func ClientCredentials(t testing.TB, issuer, id, secret string) string
- func PersonToken(t testing.TB, issuer, resource, scope string) string
- func Token(t testing.TB, issuer string, form url.Values, id, secret string) string
- type Person
- type ServiceTokens
- type SignIn
Constants ¶
const ClientRedirect = "http://127.0.0.1:1/callback"
ClientRedirect is the redirect URI test clients register; it is never dialed.
const RobotSA = "robot@test-project.iam.gserviceaccount.com"
RobotSA is a service account for client-credentials tests.
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 ¶
func Browser() auth.AuthorizationCodeFetcher
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 ¶
ClientCredentials returns a workload's access token.
func PersonToken ¶
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.
Types ¶
type ServiceTokens ¶
type ServiceTokens struct{}
ServiceTokens is an authserver.ServiceTokens that mints "ya29.sa-<account>" for any service account.
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 (*SignIn) Google ¶
func (f *SignIn) Google() authserver.GoogleClient
Google is the GoogleClient to configure the authorization server with.