sas

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnectionStringWithSASUsingExpiry added in v1.0.0

func CreateConnectionStringWithSASUsingExpiry(connectionString string, expiry time.Time) (string, error)

CreateConnectionStringWithSharedAccessSignature generates a new connection string with an embedded SharedAccessSignature and expiration. Ex: Endpoint=sb://<sb>.servicebus.windows.net;SharedAccessSignature=SharedAccessSignature sr=<sb>.servicebus.windows.net&sig=<base64-sig>&se=<expiry>&skn=<keyname>"

Types

type Signer

type Signer struct {
	KeyName string
	Key     string
	// contains filtered or unexported fields
}

Signer provides SAS token generation for use in Service Bus and Event Hub

func NewSigner

func NewSigner(keyName, key string) *Signer

NewSigner builds a new SAS signer for use in generation Service Bus and Event Hub SAS tokens

func (*Signer) SignWithDuration

func (s *Signer) SignWithDuration(uri string, interval time.Duration) (signature, expiry string, err error)

SignWithDuration signs a given for a period of time from now

func (*Signer) SignWithExpiry

func (s *Signer) SignWithExpiry(uri, expiry string) (string, error)

SignWithExpiry signs a given uri with a given expiry string

type TokenProvider

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

TokenProvider is a SAS claims-based security token provider

func NewTokenProvider

func NewTokenProvider(opts ...TokenProviderOption) (*TokenProvider, error)

NewTokenProvider builds a SAS claims-based security token provider

func (*TokenProvider) GetToken

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

GetToken gets a CBS SAS token

type TokenProviderOption

type TokenProviderOption func(*TokenProvider) error

TokenProviderOption provides configuration options for SAS Token Providers

func TokenProviderWithKey

func TokenProviderWithKey(keyName, key string, expiryDuration time.Duration) TokenProviderOption

TokenProviderWithKey configures a SAS TokenProvider to use the given key name and key (secret) for signing

func TokenProviderWithSAS

func TokenProviderWithSAS(sas string) TokenProviderOption

TokenProviderWithSAS configures the token provider with a pre-created SharedAccessSignature. auth.Token's coming back from this TokenProvider instance will always have '0' as the expiration date.

Jump to

Keyboard shortcuts

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