Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
Authorizer provides methods to get an authorization code and refresh it.
func NewAuthorizer ¶
func NewAuthorizer(tenantID, clientID string, redirect *url.URL, state string) (a *Authorizer, err error)
NewAuthorizer creates a new authorizer.
func (*Authorizer) Close ¶
func (a *Authorizer) Close() error
Close authorization process. It must be called.
func (*Authorizer) GetAuthorizeURL ¶
func (a *Authorizer) GetAuthorizeURL() string
GetAuthorizeURL returns a URL which users should access.
func (*Authorizer) RefreshToken ¶
RefreshToken refreshes a token.
func (*Authorizer) WaitResponse ¶
WaitResponse waits the user acceseses an authorization URL and grants access.
type DeviceCode ¶
type DeviceCode struct { UserCode string `json:"user_code"` DeviceCode string `json:"device_code"` VerificationURL string `json:"verification_url"` ExpiresIn string `json:"expires_in"` Interval string `json:"interval"` Message string `json:"message"` }
DeviceCode defines a structure of a response to obtain a device code.
func GetDeviceCode ¶
func GetDeviceCode(ctx context.Context, clientID string) (code *DeviceCode, err error)
GetDeviceCode gets a device code.
type ManualAuthorizer ¶
type ManualAuthorizer struct { AuthorizeURL string // contains filtered or unexported fields }
ManualAuthorizer is an authorizer which gets an authorization code manually.
func NewManualAuthorizer ¶
func NewManualAuthorizer(tenantID, clientID string, redirect *url.URL, state string) (a *ManualAuthorizer)
NewManualAuthorizer creates a new manual authorizer.
func (*ManualAuthorizer) GetAuthorizeURL ¶
func (a *ManualAuthorizer) GetAuthorizeURL() string
GetAuthorizeURL returns a URL where the user should open.
func (*ManualAuthorizer) RefreshToken ¶
RefreshToken refreshes the authorization token.
func (*ManualAuthorizer) RequestToken ¶
func (a *ManualAuthorizer) RequestToken(authorizationCode string) (token *adal.Token, err error)
RequestToken requests an authorization token.
type TokenError ¶
type TokenError struct { ErrorSummary string `json:"error"` ErrorDescription string `json:"error_description"` ErrorCodes []int `json:"error_codes"` Timestamp string `json:"timestamp"` TraceID string `json:"trace_id"` CorrelationID string `json:"correlation_id"` }
TokenError defines errors for a token.
func (*TokenError) Error ¶
func (e *TokenError) Error() string
Error returns a string representing this error.