iap_request_parser_config

package
v1.104.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package iap_request_parser_config holds the settings of an Identity-Aware Proxy request parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Audience is what the assertion must have been minted for, which names the resource IAP is in
	// front of. For a load balancer it is "/projects/{number}/global/backendServices/{id}", and for
	// App Engine "/projects/{number}/apps/{id}"; BackendServiceAudience builds the first.
	//
	// It is what stops an assertion minted for another service being accepted here. Every
	// deployment behind IAP is issued assertions by the same IAP, signed with the same keys, so the
	// audience is the only thing distinguishing one service's from another's.
	Audience string

	// AllowedEmails are the accounts admitted, where a deployment wants to name them. Empty admits
	// whoever IAP itself admitted, which is the ordinary case: IAP has an access policy, and
	// repeating it here means maintaining it twice.
	AllowedEmails []string

	// AllowedHostedDomains are the Google Workspace domains admitted, read from the hd claim.
	// Empty admits any.
	//
	// A consumer domain has no hd claim at all, so naming a domain here also turns away personal
	// accounts.
	AllowedHostedDomains []string

	// JwkUrl is where the signing keys are published. A nil one is IAP's.
	JwkUrl *url.URL
}

func New

func New(options ...Option) *Config

New builds a config from the options. A nil option is skipped, so a caller can pass one conditionally without guarding the call.

type Option

type Option func(*Config)

func WithAllowedEmails

func WithAllowedEmails(emails ...string) Option

WithAllowedEmails adds to what an earlier call set rather than replacing it.

func WithAllowedHostedDomains

func WithAllowedHostedDomains(domains ...string) Option

WithAllowedHostedDomains adds to what an earlier call set rather than replacing it.

func WithAudience

func WithAudience(audience string) Option

func WithJwkUrl

func WithJwkUrl(jwkUrl *url.URL) Option

Jump to

Keyboard shortcuts

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