package credential
import "github.com/Azure/azure-sdk-for-go/sdk/internal/test/credential"
Index ¶
Functions ¶
func New ¶
func New(*NewOptions) (azcore.TokenCredential, error)
New constructs a credential for use in tests. In playback mode, it returns Fake, which always provides valid tokens. In live and record modes, it returns a credential based on the environment:
- azidentity.AzurePipelinesCredential when running in an Azure Pipelines AzurePowerShell task
- azidentity.ClientSecretCredential, if New-TestResources.ps1 provided service principal details
- azidentity.DefaultAzureCredential otherwise
Types ¶
type Fake ¶
type Fake struct{}
Fake always returns a valid token. Use this type to fake authentication in tests that never send a real request. For live or recorded tests, call New instead.
func (Fake) GetToken ¶
func (Fake) GetToken(context.Context, policy.TokenRequestOptions) (azcore.AccessToken, error)
GetToken returns a fake access token
type NewOptions ¶
type NewOptions struct{}
Source Files ¶
- Version
- v1.11.1 (latest)
- Published
- Apr 7, 2025
- Platform
- windows/amd64
- Imports
- 7 packages
- Last checked
- 1 hour ago –
Tools for package owners.