azure

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMSIResourceID is the default resource ID to use as the intended
	// audience of the MSI token. The current value is the service ID for the
	// Resource Manager API.
	DefaultMSIResourceID = "https://management.azure.com/"
	PluginName           = "azure_msi"
)

Variables

View Source
var DefaultAgentPathTemplate = agentpathtemplate.MustParse("/{{ .PluginName }}/{{ .TenantID }}/{{ .PrincipalID }}")

DefaultAgentPathTemplate is the default text/template

Functions

func FetchMSIToken

func FetchMSIToken(ctx context.Context, cl HTTPClient, resource string) (string, error)

func MakeAgentID

func MakeAgentID(td spiffeid.TrustDomain, agentPathTemplate *agentpathtemplate.Template, claims *MSITokenClaims) (spiffeid.ID, error)

Types

type ComputeMetadata

type ComputeMetadata struct {
	Name              string `json:"name"`
	SubscriptionID    string `json:"subscriptionId"`
	ResourceGroupName string `json:"resourceGroupName"`
}

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

type HTTPClientFunc

type HTTPClientFunc func(*http.Request) (*http.Response, error)

func (HTTPClientFunc) Do

func (fn HTTPClientFunc) Do(req *http.Request) (*http.Response, error)

type InstanceMetadata

type InstanceMetadata struct {
	Compute ComputeMetadata `json:"compute"`
}

func FetchInstanceMetadata

func FetchInstanceMetadata(ctx context.Context, cl HTTPClient) (*InstanceMetadata, error)

type MSIAttestationData

type MSIAttestationData struct {
	Token string `json:"token"`
}

type MSITokenClaims

type MSITokenClaims struct {
	jwt.Claims
	TenantID    string `json:"tid,omitempty"`
	PrincipalID string `json:"sub,omitempty"`
}

Jump to

Keyboard shortcuts

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