Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface {
VerifyDevice(ctx context.Context) (*DeviceVerification, error)
GetAccessTokenForDevice(ctx context.Context, v DeviceVerification) (string, error)
}
Authenticator is the interface for authentication via device oauth
type DeviceAuthenticator ¶
type DeviceAuthenticator struct {
BaseURL *url.URL
Clock clock.Clock
ClientID string
// contains filtered or unexported fields
}
DeviceAuthenticator performs the authentication flow for logging in.
func New ¶
func New(authURL string) (*DeviceAuthenticator, error)
New returns an instance of the DeviceAuthenticator
func (*DeviceAuthenticator) GetAccessTokenForDevice ¶
func (d *DeviceAuthenticator) GetAccessTokenForDevice(ctx context.Context, v *DeviceVerification) (*OAuthTokenResponse, error)
GetAccessTokenForDevice uses the device verification response to fetch an access token.
func (*DeviceAuthenticator) VerifyDevice ¶
func (d *DeviceAuthenticator) VerifyDevice(ctx context.Context) (*DeviceVerification, error)
VerifyDevice performs the device verification API calls.
type DeviceCodeResponse ¶
type DeviceCodeResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationCompleteURI string `json:"verification_uri_complete"`
ExpiresIn int `json:"expires_in"`
PollingInterval int `json:"interval"`
}
DeviceCodeResponse encapsulates the response for obtaining a device code.
type DeviceVerification ¶
type DeviceVerification struct {
DeviceCode string
UserCode string
VerificationURL string
VerificationCompleteURL string
CheckInterval time.Duration
ExpiresAt time.Time
}
DeviceVerification represents the response from verifying a device.
type OAuthTokenResponse ¶
type OAuthTokenResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in,string"`
TokenType string `json:"token_type"`
UserID string `json:"user_id"`
}
OAuthTokenResponse contains the information returned after fetching an access token for a device.
Click to show internal directories.
Click to hide internal directories.