Documentation
¶
Index ¶
- func NewGraphClient(accessToken string, expiresOn time.Time, ipv4Only bool) (*msgraphsdk.GraphServiceClient, error)
- func NewGraphClientWithCredential(cred azcore.TokenCredential, scopes []string, ipv4Only bool) (*msgraphsdk.GraphServiceClient, error)
- func NewIPv4HTTPClient() *http.Client
- func NewIPv4Transport() *http.Transport
- type StaticTokenCredential
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGraphClient ¶
func NewGraphClient(accessToken string, expiresOn time.Time, ipv4Only bool) (*msgraphsdk.GraphServiceClient, error)
NewGraphClient creates an authenticated msgraph-sdk-go client from a raw access token. Uses .default scope for the auth provider (fine for static tokens).
func NewGraphClientWithCredential ¶ added in v0.2.0
func NewGraphClientWithCredential(cred azcore.TokenCredential, scopes []string, ipv4Only bool) (*msgraphsdk.GraphServiceClient, error)
NewGraphClientWithCredential creates an authenticated msgraph-sdk-go client from a live azcore.TokenCredential with explicit scopes. For MSAL-backed credentials, the scopes MUST match what was used during login so that MSAL can find cached tokens and silently refresh using the stored refresh token.
func NewIPv4HTTPClient ¶
NewIPv4HTTPClient returns an *http.Client with IPv4-only transport. This satisfies azcore's policy.Transporter interface (has Do method) and can be used as azcore.ClientOptions.Transport.
func NewIPv4Transport ¶
NewIPv4Transport returns an http.Transport that only resolves IPv4 addresses. Useful for cloud regions with broken IPv6 egress (e.g. some Azure regions).
Types ¶
type StaticTokenCredential ¶
type StaticTokenCredential struct {
// contains filtered or unexported fields
}
StaticTokenCredential wraps a pre-acquired access token as an azcore.TokenCredential. SECURITY: The token is only held in memory and never logged.
func (*StaticTokenCredential) GetToken ¶
func (s *StaticTokenCredential) GetToken(_ context.Context, _ policy.TokenRequestOptions) (azcore.AccessToken, error)
GetToken returns the stored access token.