auth

package
v0.1.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertBase64ToCert

func ConvertBase64ToCert(b64, password string) ([]*x509.Certificate, crypto.PrivateKey, error)

func ConvertFileToBase64

func ConvertFileToBase64(path string) (string, error)

Types

type AuthenticationMethod

type AuthenticationMethod string
const (
	ServicePrincipalSecretAuth                AuthenticationMethod = "ServicePrincipalSecret"
	ServicePrincipalCertificateAuth           AuthenticationMethod = "ServicePrincipalCertificate"
	ServicePrincipalOIDCAuth                  AuthenticationMethod = "ServicePrincipalOIDC"
	AzureDevOpsWorkloadIdentityFederationAuth AuthenticationMethod = "AzureDevOpsWorkloadIdentityFederation"
	ManagedServiceIdentityUserAuth            AuthenticationMethod = "ManagedServiceIdentityUser"
	ManagedServiceIdentitySystemAuth          AuthenticationMethod = "ManagedServiceIdentitySystem"
	AzureCLIAuth                              AuthenticationMethod = "AzureCLI"
	AzureDevCLIAuth                           AuthenticationMethod = "AzureDeveloperCLI"
	TokenAuth                                 AuthenticationMethod = "Token"
)

Supported authentication methods.

type Config

type Config struct {
	UseCLI               bool
	UseDevCLI            bool
	UseOIDC              bool
	UseMSI               bool
	Token                string
	Environment          cloud.Configuration
	AuxiliaryTenantIDs   []string
	TenantID             string
	ClientID             string
	ClientSecret         string
	ClientCertificate    []*x509.Certificate
	ClientCertificateKey crypto.PrivateKey
	OIDC                 OIDCConfig
}

Config represents the authentication configuration.

type CredentialResponse

type CredentialResponse struct {
	Cred       azcore.TokenCredential
	AuthMethod AuthenticationMethod
	Info       string
}

func NewCredential

func NewCredential(cfg Config) (CredentialResponse, error)

NewCredential evaluates the authentication method and returns the appropriate credential.

type OIDCConfig

type OIDCConfig struct {
	RequestURL                     string
	RequestToken                   string
	Token                          string
	AzureDevOpsServiceConnectionID string
}

OIDCConfig represents the OpenID Connect configuration.

type TokenCredential

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

TokenCredential is a TokenCredential that returns a static bearer token.

func NewTokenCredential

func NewTokenCredential(token string) (*TokenCredential, error)

NewTokenCredential creates a new instance of TokenCredential.

func (*TokenCredential) GetToken

GetToken returns the bearer token.

Jump to

Keyboard shortcuts

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