signintest

package
v0.0.0-...-c38336e Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package signintest provides shared test code for testing signing in with Google accounts.

Index

Constants

View Source
const ClientID = "insecure_test_client_id"

ClientID is a fake OAuth client ID to be used with googlesignin.Authenticator in tests.

Variables

This section is empty.

Functions

func InsecureKeys

func InsecureKeys() jwkkeys.Set

InsecureKeys returns a key set containing an insecure test key. Should only be used in tests.

func InsecureToken

func InsecureToken(audience string, issuer string, email string, hostedDomain string) string

InsecureToken returns a new token that is signed by a key in InsecureKeys. Should only be used in tests.

Types

type RequestAuthenticator

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

RequestAuthenticator makes requests authenticated for test purposes.

func InsecureTestAuthenticator

func InsecureTestAuthenticator(authenticator *googlesignin.Authenticator) *RequestAuthenticator

InsecureTestAuthenticator modifies the Authenticator accept insecure test keys, returning a RequestAuthenticator that can be use to make authorized *http.Request objects. You must use signintest.ClientID as the OAuth client ID when creating authenticator.

func (*RequestAuthenticator) InsecureMakeAuthenticated

func (r *RequestAuthenticator) InsecureMakeAuthenticated(
	request *http.Request, email string,
) *http.Request

InsecureMakeAuthenticated makes request an authenticated request, using the insecure test keys. It will then be accepted by handlers that use MustGetEmail

Jump to

Keyboard shortcuts

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