Documentation ¶
Overview ¶
Package sas provides SAS token functionality 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 Signer ¶
Signer provides SAS token generation for use in Service Bus and Event Hub
func NewSigner ¶
NewSigner builds a new SAS signer for use in generation Service Bus and Event Hub SAS tokens
func (*Signer) SignWithDuration ¶
SignWithDuration signs a given for a period of time from now
func (*Signer) SignWithExpiry ¶
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
type TokenProviderOption ¶
type TokenProviderOption func(*TokenProvider) error
TokenProviderOption provides configuration options for SAS Token Providers
func TokenProviderWithEnvironmentVars ¶
func TokenProviderWithEnvironmentVars() TokenProviderOption
TokenProviderWithEnvironmentVars creates a new SAS TokenProvider from environment variables
There are two sets of environment variables which can produce a SAS TokenProvider ¶
1) Expected Environment Variables:
- "EVENTHUB_KEY_NAME" the name of the Event Hub key
- "EVENTHUB_KEY_VALUE" the secret for the Event Hub key named in "EVENTHUB_KEY_NAME"
2) Expected Environment Variable:
- "EVENTHUB_CONNECTION_STRING" connection string from the Azure portal
looks like: Endpoint=sb://namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=superSecret1234=
func TokenProviderWithKey ¶
func TokenProviderWithKey(keyName, key string) TokenProviderOption
TokenProviderWithKey configures a SAS TokenProvider to use the given key name and key (secret) for signing