Documentation ¶
Index ¶
- Constants
- func BuildURL(serverURL, urlFragment string, addRestAPI bool, queryValues url.Values) (string, error)
- func CredentialsJWTBearer(clientID, clientSecret, jwt string, sandbox bool) goauth.Credentials
- func NewClientPassword(oc goauth.CredentialsOAuth2) (*http.Client, error)
- func NewClientPasswordSimple(oc goauth.CredentialsOAuth2) (*http.Client, error)
- func NewEndpoint(hostnameOrBasePath string) oauth2.Endpoint
- func NewHTTPClientEnvFlexStatic(envPrefix string) (*http.Client, error)
- func NewTokenCLI(ctx context.Context, creds goauth.Credentials, state string) (token *oauth2.Token, err error)
- func NewTokenPassword(oc goauth.CredentialsOAuth2) (*oauth2.Token, error)
- func PasswordCredentialsToHash(pwdCreds goauth.CredentialsOAuth2, salt []byte) string
- func RetrieveToken(cfg oauth2.Config, params url.Values) (*oauth2.Token, error)
- func UsernameExtensionPasswordToHash(username, extension, password string, salt []byte) string
- func UsernameExtensionPasswordToString(username, password string) string
- type ClientUtil
- type RcToken
- type RingCentralAccount
- type RingCentralContact
- type RingCentralExtensionInfo
Constants ¶
View Source
const ( EnvServerURL = "RINGCENTRAL_SERVER_URL" EnvClientID = "RINGCENTRAL_CLIENT_ID" EnvClientSecret = "RINGCENTRAL_CLIENT_SECRET" EnvAppName = "RINGCENTRAL_APP_NAME" EnvAppVersion = "RINGCENTRAL_APP_VERSION" EnvRedirectURL = "RINGCENTRAL_OAUTH_REDIRECT_URL" EnvUsername = "RINGCENTRAL_USERNAME" EnvExtension = "RINGCENTRAL_EXTENSION" EnvPassword = "RINGCENTRAL_PASSWORD" ConfKeyAppName = "app_name" ConfKeyAppVersion = "app_version" )
View Source
const ( ServerURLProduction = "https://platform.ringcentral.com" ServerURLSandbox = "https://platform.devtest.ringcentral.com" ProductionHostname = "platform.ringcentral.com" SandboxHostname = "platform.devtest.ringcentral.com" AuthURLFormat = "https://%s/restapi/oauth/authorize" TokenURLFormat = "https://%s/restapi/oauth/token" // #nosec G101 AuthURLPart = "restapi/oauth/authorize" TokenURLPart = "restapi/oauth/token" // #nosec G101 MeURL = "/restapi/v1.0/account/~/extension/~" RestAPI1dot0Fragment = "restapi/v1.0" )
Variables ¶
This section is empty.
Functions ¶
func CredentialsJWTBearer ¶ added in v0.21.1
func CredentialsJWTBearer(clientID, clientSecret, jwt string, sandbox bool) goauth.Credentials
CredentialsJWTBearer implements RingCentral's JWT Bearer Flow: https://developers.ringcentral.com/guide/authentication/jwt/quick-start
func NewClientPassword ¶
func NewClientPassword(oc goauth.CredentialsOAuth2) (*http.Client, error)
NewClientPassword uses dedicated password grant handling.
func NewClientPasswordSimple ¶
func NewClientPasswordSimple(oc goauth.CredentialsOAuth2) (*http.Client, error)
NewClientPasswordSimple uses OAuth2 package password grant handling.
func NewEndpoint ¶
func NewHTTPClientEnvFlexStatic ¶ added in v0.13.0
func NewTokenCLI ¶ added in v0.20.16
func NewTokenPassword ¶
func NewTokenPassword(oc goauth.CredentialsOAuth2) (*oauth2.Token, error)
func PasswordCredentialsToHash ¶
func PasswordCredentialsToHash(pwdCreds goauth.CredentialsOAuth2, salt []byte) string
func RetrieveToken ¶
Types ¶
type ClientUtil ¶
type ClientUtil struct { Client *http.Client `json:"-"` ServerURL string User RingCentralExtensionInfo `json:"user,omitempty"` }
ClientUtil is a client library to retrieve user info from the Facebook API.
func NewClientUtil ¶
func NewClientUtil(client *http.Client) ClientUtil
func (*ClientUtil) GetSCIMUser ¶
func (cu *ClientUtil) GetSCIMUser() (scim.User, error)
func (*ClientUtil) GetUserinfo ¶
func (cu *ClientUtil) GetUserinfo() (RingCentralExtensionInfo, error)
GetUserinfo retrieves the userinfo from the https://graph.facebook.com/v2.9/{user-id} endpoint.
func (*ClientUtil) SetClient ¶
func (cu *ClientUtil) SetClient(client *http.Client)
type RcToken ¶
type RcToken struct { AccessToken string `json:"access_token,omitempty"` TokenType string `json:"token_type,omitempty"` Scope string `json:"scope,omitempty"` ExpiresIn int64 `json:"expires_in,omitempty"` RefreshToken string `json:"refresh_token,omitempty"` RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in,omitempty"` OwnerID string `json:"owner_id,omitempty"` EndpointID string `json:"endpoint_id,omitempty"` Expiry time.Time `json:"expiry,omitempty"` RefreshTokenExpiry time.Time `json:"refresh_token_expiry,omitempty"` // contains filtered or unexported fields }
type RingCentralAccount ¶
type RingCentralContact ¶
type RingCentralExtensionInfo ¶
type RingCentralExtensionInfo struct { ID int64 `json:"id,omitempty"` ExtensionNumber string `json:"extensionNumber,omitempty"` Contact RingCentralContact `json:"contact,omitempty"` Name string `json:"name,omitempty"` Account RingCentralAccount `json:"account,omitempty"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.