Documentation ¶
Index ¶
- type ClientConfig
- type ClientSession
- type OAuthClient
- func (o *OAuthClient) BuildAuthorizeURL() string
- func (o *OAuthClient) CompleteAuthorization(code string) error
- func (o *OAuthClient) GetAccessToken(limitScope string, forceRefresh bool) (accessToken string, err error)
- func (o *OAuthClient) GetSessionInfo() (*ClientSession, error)
- func (o *OAuthClient) HasActiveSession() bool
- func (o *OAuthClient) IsValidState(state string) bool
- func (o *OAuthClient) NewSession() error
- func (o *OAuthClient) RestoreSession(session ClientSession) error
- func (o *OAuthClient) Revoke() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { URL string ClientID string ClientSecret string PKCE bool Scope string RedirectURI string }
ClientConfig configuration for the OAuthClient
type ClientSession ¶
type OAuthClient ¶
type OAuthClient struct {
// contains filtered or unexported fields
}
OAuthClient a new oauth client to talk with fleetcommand
func (*OAuthClient) BuildAuthorizeURL ¶
func (o *OAuthClient) BuildAuthorizeURL() string
BuildAuthorizeURL builds the authorize url the user would visit to grant authorization
func (*OAuthClient) CompleteAuthorization ¶
func (o *OAuthClient) CompleteAuthorization(code string) error
CompleteAuthorization exchanges authorization code for access token and refresh (if offline_access scope was used)
func (*OAuthClient) GetAccessToken ¶
func (o *OAuthClient) GetAccessToken(limitScope string, forceRefresh bool) (accessToken string, err error)
GetAccessToken if current token has desired scopes and hasn't expired will be returned, otherwise refreshToken if available will be used to obtain a valid accessToken
func (*OAuthClient) GetSessionInfo ¶
func (o *OAuthClient) GetSessionInfo() (*ClientSession, error)
func (*OAuthClient) HasActiveSession ¶
func (o *OAuthClient) HasActiveSession() bool
HasActiveSession returns true if there is an active session
func (*OAuthClient) IsValidState ¶
func (o *OAuthClient) IsValidState(state string) bool
IsValidState compares state to stored state to see if valid
func (*OAuthClient) NewSession ¶
func (o *OAuthClient) NewSession() error
NewSession initializes a new session
func (*OAuthClient) RestoreSession ¶
func (o *OAuthClient) RestoreSession(session ClientSession) error
func (*OAuthClient) Revoke ¶
func (o *OAuthClient) Revoke() error
Revoke invalidates the token or logs out