aad

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package aad provides an implementation of an Azure Active Directory JWT provider which implements TokenProvider from package auth for use with Azure Event Hubs and Service Bus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTProviderOption

type JWTProviderOption func(provider *TokenProviderConfiguration) error

JWTProviderOption provides configuration options for constructing AAD Token Providers

func JWTProviderWithAADToken

func JWTProviderWithAADToken(aadToken *adal.ServicePrincipalToken) JWTProviderOption

JWTProviderWithAADToken configures the token provider to use a specific Azure Active Directory Service Principal token

func JWTProviderWithAzureEnvironment

func JWTProviderWithAzureEnvironment(env *azure.Environment) JWTProviderOption

JWTProviderWithAzureEnvironment configures the token provider to use a specific Azure Environment

func JWTProviderWithEnvironmentVars

func JWTProviderWithEnvironmentVars() JWTProviderOption

JWTProviderWithEnvironmentVars configures the TokenProvider using the environment variables available

  1. Client Credentials: attempt to authenticate with a Service Principal via "AZURE_TENANT_ID", "AZURE_CLIENT_ID" and "AZURE_CLIENT_SECRET"
  1. Client Certificate: attempt to authenticate with a Service Principal via "AZURE_TENANT_ID", "AZURE_CLIENT_ID", "AZURE_CERTIFICATE_PATH" and "AZURE_CERTIFICATE_PASSWORD"

3. Managed Service Identity (MSI): attempt to authenticate via MSI

The Azure Environment used can be specified using the name of the Azure Environment set in "AZURE_ENVIRONMENT" var.

func JWTProviderWithResourceURI

func JWTProviderWithResourceURI(resourceURI string) JWTProviderOption

JWTProviderWithResourceURI configures the token provider to use a specific eventhubResourceURI URI

type TokenProvider

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

TokenProvider provides cbs.TokenProvider functionality for Azure Active Directory JWTs

func NewJWTProvider

func NewJWTProvider(opts ...JWTProviderOption) (*TokenProvider, error)

NewJWTProvider builds an Azure Active Directory claims-based security token provider

func (*TokenProvider) GetToken

func (t *TokenProvider) GetToken(audience string) (*auth.Token, error)

GetToken gets a CBS JWT

type TokenProviderConfiguration

type TokenProviderConfiguration struct {
	TenantID            string
	ClientID            string
	ClientSecret        string
	CertificatePath     string
	CertificatePassword string
	ResourceURI         string

	Env *azure.Environment
	// contains filtered or unexported fields
}

TokenProviderConfiguration provides configuration parameters for building JWT AAD providers

func (*TokenProviderConfiguration) NewServicePrincipalToken

func (c *TokenProviderConfiguration) NewServicePrincipalToken() (*adal.ServicePrincipalToken, error)

NewServicePrincipalToken creates a new Azure Active Directory Service Principal token provider

Jump to

Keyboard shortcuts

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