Documentation
¶
Index ¶
- func NewTokenCli(creds Credentials, state string) (token *oauth2.Token, err error)
- type ApplicationCredentials
- func (ac *ApplicationCredentials) AppNameAndVersion() string
- func (app *ApplicationCredentials) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
- func (app *ApplicationCredentials) Config() oauth2.Config
- func (app *ApplicationCredentials) Exchange(code string) (*oauth2.Token, error)
- func (app *ApplicationCredentials) InflateURL(apiUrlPath string) string
- func (app *ApplicationCredentials) IsGrantType(grantType string) bool
- type Credentials
- func (creds *Credentials) NewClient() (*http.Client, error)
- func (creds *Credentials) NewClientCli(oauth2State string) (*http.Client, error)
- func (creds *Credentials) NewSimpleClient() (*httpsimple.SimpleClient, error)
- func (creds *Credentials) NewToken() (*oauth2.Token, error)
- func (creds *Credentials) NewTokenCli(oauth2State string) (*oauth2.Token, error)
- type CredentialsSet
- func (set *CredentialsSet) Accounts() []string
- func (set *CredentialsSet) Get(key string) (Credentials, error)
- func (set *CredentialsSet) GetClient(key string) (*http.Client, error)
- func (set *CredentialsSet) Keys() []string
- func (set *CredentialsSet) NewSimpleClient(key string) (*httpsimple.SimpleClient, error)
- type PasswordCredentials
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTokenCli ¶
func NewTokenCli(creds Credentials, state string) (token *oauth2.Token, err error)
Types ¶
type ApplicationCredentials ¶
type ApplicationCredentials struct {
ServerURL string `json:"serverURL,omitempty"`
ApplicationID string `json:"applicationID,omitempty"`
ClientID string `json:"clientID,omitempty"`
ClientSecret string `json:"clientSecret,omitempty"`
OAuth2Endpoint oauth2.Endpoint `json:"oauth2Endpoint,omitempty"`
RedirectURL string `json:"redirectURL,omitempty"`
AppName string `json:"applicationName,omitempty"`
AppVersion string `json:"applicationVersion,omitempty"`
OAuthEndpointID string `json:"oauthEndpointID,omitempty"`
AccessTokenTTL int64 `json:"accessTokenTTL,omitempty"`
RefreshTokenTTL int64 `json:"refreshTokenTTL,omitempty"`
GrantType string `json:"grantType,omitempty"`
}
func (*ApplicationCredentials) AppNameAndVersion ¶
func (ac *ApplicationCredentials) AppNameAndVersion() string
func (*ApplicationCredentials) AuthCodeURL ¶
func (app *ApplicationCredentials) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
func (*ApplicationCredentials) Config ¶
func (app *ApplicationCredentials) Config() oauth2.Config
func (*ApplicationCredentials) Exchange ¶
func (app *ApplicationCredentials) Exchange(code string) (*oauth2.Token, error)
func (*ApplicationCredentials) InflateURL ¶
func (app *ApplicationCredentials) InflateURL(apiUrlPath string) string
func (*ApplicationCredentials) IsGrantType ¶
func (app *ApplicationCredentials) IsGrantType(grantType string) bool
type Credentials ¶
type Credentials struct {
Application ApplicationCredentials `json:"application,omitempty"`
PasswordCredentials PasswordCredentials `json:"passwordCredentials,omitempty"`
Token *oauth2.Token `json:"token,omitempty"`
}
func NewCredentialsJSONs ¶
func NewCredentialsJSONs(appJson, userJson, accessToken []byte) (Credentials, error)
func ReadCredentialsFromFile ¶
func ReadCredentialsFromFile(filename, key string) (Credentials, error)
func (*Credentials) NewClientCli ¶
func (creds *Credentials) NewClientCli(oauth2State string) (*http.Client, error)
func (*Credentials) NewSimpleClient ¶
func (creds *Credentials) NewSimpleClient() (*httpsimple.SimpleClient, error)
func (*Credentials) NewTokenCli ¶
func (creds *Credentials) NewTokenCli(oauth2State string) (*oauth2.Token, error)
NewTokenCli retrieves a token using CLI approach for OAuth 2.0 authorization code or password grant.
type CredentialsSet ¶
type CredentialsSet struct {
Credentials map[string]Credentials
}
func ReadFileCredentialsSet ¶
func ReadFileCredentialsSet(filename string) (CredentialsSet, error)
func (*CredentialsSet) Accounts ¶
func (set *CredentialsSet) Accounts() []string
func (*CredentialsSet) Get ¶
func (set *CredentialsSet) Get(key string) (Credentials, error)
func (*CredentialsSet) GetClient ¶
func (set *CredentialsSet) GetClient(key string) (*http.Client, error)
func (*CredentialsSet) Keys ¶
func (set *CredentialsSet) Keys() []string
func (*CredentialsSet) NewSimpleClient ¶
func (set *CredentialsSet) NewSimpleClient(key string) (*httpsimple.SimpleClient, error)
type PasswordCredentials ¶
type PasswordCredentials struct {
GrantType string `url:"grant_type"`
AccessTokenTTL int64 `url:"access_token_ttl"`
RefreshTokenTTL int64 `url:"refresh_token_ttl"`
Username string `json:"username" url:"username"`
Extension string `json:"extension" url:"extension"`
Password string `json:"password" url:"password"`
EndpointId string `url:"endpoint_id"`
EngageVoiceAccountId int64 `json:"engageVoiceAccountId"`
}
func (*PasswordCredentials) URLValues ¶
func (pw *PasswordCredentials) URLValues() url.Values
func (*PasswordCredentials) UsernameSimple ¶
func (uc *PasswordCredentials) UsernameSimple() string
Click to show internal directories.
Click to hide internal directories.