Documentation ¶
Overview ¶
Package base contains a "Base" client that is used by the external public.Client and confidential.Client. Base holds shared attributes that must be available to both clients and methods that act as shared calls.
Index ¶
- Constants
- type AcquireTokenAuthCodeParameters
- type AcquireTokenSilentParameters
- type AuthResult
- type Client
- func (b Client) Account(homeAccountID string) shared.Account
- func (b Client) AcquireTokenByAuthCode(ctx context.Context, authCodeParams AcquireTokenAuthCodeParameters) (AuthResult, error)
- func (b Client) AcquireTokenSilent(ctx context.Context, silent AcquireTokenSilentParameters) (AuthResult, error)
- func (b Client) AllAccounts() []shared.Account
- func (b Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, scopes []string, ...) (string, error)
- func (b Client) AuthResultFromToken(ctx context.Context, authParams authority.AuthParams, ...) (AuthResult, error)
- type Option
Constants ¶
const (
// AuthorityPublicCloud is the default AAD authority host
AuthorityPublicCloud = "https://login.microsoftonline.com/common"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcquireTokenAuthCodeParameters ¶
type AcquireTokenAuthCodeParameters struct { Scopes []string Code string Challenge string RedirectURI string AppType accesstokens.AppType Credential *accesstokens.Credential }
AcquireTokenAuthCodeParameters contains the parameters required to acquire an access token using the auth code flow. To use PKCE, set the CodeChallengeParameter. Code challenges are used to secure authorization code grants; for more information, visit https://tools.ietf.org/html/rfc7636.
type AcquireTokenSilentParameters ¶
type AcquireTokenSilentParameters struct { Scopes []string Account shared.Account RequestType accesstokens.AppType Credential *accesstokens.Credential IsAppCache bool }
AcquireTokenSilentParameters contains the parameters to acquire a token silently (from cache).
type AuthResult ¶
type AuthResult struct { Account shared.Account IDToken accesstokens.IDToken AccessToken string ExpiresOn time.Time GrantedScopes []string DeclinedScopes []string }
AuthResult contains the results of one token acquisition operation in PublicClientApplication or ConfidentialClientApplication. For details see https://aka.ms/msal-net-authenticationresult
func AuthResultFromStorage ¶
func AuthResultFromStorage(storageTokenResponse storage.TokenResponse) (AuthResult, error)
AuthResultFromStorage creates an AuthResult from a storage token response (which is generated from the cache).
func NewAuthResult ¶
func NewAuthResult(tokenResponse accesstokens.TokenResponse, account shared.Account) (AuthResult, error)
NewAuthResult creates an AuthResult.
type Client ¶
type Client struct { Token *oauth.Client AuthParams authority.AuthParams // DO NOT EVER MAKE THIS A POINTER! See "Note" in New(). // contains filtered or unexported fields }
Client is a base client that provides access to common methods and primatives that can be used by multiple clients.
func New ¶
func New(clientID string, authorityURI string, token *oauth.Client, options ...Option) (Client, error)
New is the constructor for Base.
func (Client) AcquireTokenByAuthCode ¶
func (b Client) AcquireTokenByAuthCode(ctx context.Context, authCodeParams AcquireTokenAuthCodeParameters) (AuthResult, error)
func (Client) AcquireTokenSilent ¶
func (b Client) AcquireTokenSilent(ctx context.Context, silent AcquireTokenSilentParameters) (AuthResult, error)
func (Client) AllAccounts ¶
func (Client) AuthCodeURL ¶
func (b Client) AuthCodeURL(ctx context.Context, clientID, redirectURI string, scopes []string, authParams authority.AuthParams) (string, error)
AuthCodeURL creates a URL used to acquire an authorization code.
func (Client) AuthResultFromToken ¶
func (b Client) AuthResultFromToken(ctx context.Context, authParams authority.AuthParams, token accesstokens.TokenResponse, cacheWrite bool) (AuthResult, error)
type Option ¶
type Option func(c *Client)
Option is an optional argument to the New constructor.
func WithCacheAccessor ¶
func WithCacheAccessor(ca cache.ExportReplace) Option
WithCacheAccessor allows you to set some type of cache for storing authentication tokens.