wif

package
v1.106.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: BSD-3-Clause Imports: 18 Imported by: 4 modules, 1 package

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 wif deals with obtaining ID tokens from provider VMs to be used as part of Workload Identity Federation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObtainProviderToken

func ObtainProviderToken(ctx context.Context, audience string) (string, error)

ObtainProviderToken tries to detect what provider the client is running in and then tries to obtain an ID token for the audience that is passed as an argument To detect the environment, we do it in the following intentional order:

  1. GitHub Actions (strongest env signals; may run atop any cloud)
  2. Azure hosts that announce themselves via env vars (AKS workload identity, App Service / Container Apps identity endpoint); these must precede the metadata probes because AKS pods can reach the node's IMDS
  3. AWS via IMDSv2 token endpoint (does not require env vars)
  4. GCP via metadata header semantics
  5. Azure via IMDS (VMs, scale sets, container instances)
  6. AWS ECS via ECS token endpoint and env vars provided by ECS

Types

type Environment

type Environment string
const (
	EnvGitHub Environment = "github"
	EnvAWS    Environment = "aws"
	EnvGCP    Environment = "gcp"
	EnvAzure  Environment = "azure"
	EnvNone   Environment = "none"
)

Jump to

Keyboard shortcuts

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