Documentation ¶
Index ¶
- Constants
- func CreateRandomState() string
- func GetAccessToken(prevToken integrations.SharedOAuthModel, conf *oauth2.Config, ...) (string, *time.Time, error)
- func MakeUpdateGithubAppOauthIntegrationFunction(o *integrations.GithubAppOAuthIntegration, repo repository.Repository) func(accessToken []byte, refreshToken []byte, expiry time.Time) error
- func MakeUpdateOAuthIntegrationTokenFunction(o *integrations.OAuthIntegration, repo repository.Repository) func(accessToken []byte, refreshToken []byte, expiry time.Time) error
- func NewDigitalOceanClient(cfg *Config) *oauth2.Config
- func NewGithubClient(cfg *Config) *oauth2.Config
- func NewGoogleClient(cfg *Config) *oauth2.Config
- func NewSlackClient(cfg *Config) *oauth2.Config
- type Config
- type GithubAppConf
Constants ¶
View Source
const ( GithubAuthURL string = "https://github.com/login/oauth/authorize" GithubTokenURL string = "https://github.com/login/oauth/access_token" DOAuthURL string = "https://cloud.digitalocean.com/v1/oauth/authorize" DOTokenURL string = "https://cloud.digitalocean.com/v1/oauth/token" GoogleAuthURL string = "https://accounts.google.com/o/oauth2/v2/auth" GoogleTokenURL string = "https://oauth2.googleapis.com/token" SlackAuthURL string = "https://slack.com/oauth/v2/authorize" SlackTokenURL string = "https://slack.com/api/oauth.v2.access" )
Variables ¶
This section is empty.
Functions ¶
func CreateRandomState ¶
func CreateRandomState() string
func GetAccessToken ¶
func GetAccessToken( prevToken integrations.SharedOAuthModel, conf *oauth2.Config, updateToken func(accessToken []byte, refreshToken []byte, expiry time.Time) error, ) (string, *time.Time, error)
GetAccessToken retrieves an access token for a given client. It updates the access token in the DB if necessary
func MakeUpdateGithubAppOauthIntegrationFunction ¶ added in v0.6.0
func MakeUpdateGithubAppOauthIntegrationFunction( o *integrations.GithubAppOAuthIntegration, repo repository.Repository) func(accessToken []byte, refreshToken []byte, expiry time.Time) error
MakeUpdateGithubAppOauthIntegrationFunction creates a function to be passed to GetAccessToken that updates the GithubAppOauthIntegration if it needs to be updated
func MakeUpdateOAuthIntegrationTokenFunction ¶ added in v0.6.0
func MakeUpdateOAuthIntegrationTokenFunction( o *integrations.OAuthIntegration, repo repository.Repository) func(accessToken []byte, refreshToken []byte, expiry time.Time) error
MakeUpdateOAuthIntegrationTokenFunction creates a function to be passed to GetAccessToken that updates the OauthIntegration if it needs to be updated
func NewDigitalOceanClient ¶
func NewGithubClient ¶
func NewGoogleClient ¶ added in v0.3.1
func NewSlackClient ¶ added in v0.7.2
Types ¶
type GithubAppConf ¶ added in v0.5.0
type GithubAppConf struct { AppName string WebhookSecret string SecretPath string AppID int64 oauth2.Config }
GithubAppConf is standard oauth2 config but it need to keeps track of the app name and webhook secret
func NewGithubAppClient ¶ added in v0.5.0
Click to show internal directories.
Click to hide internal directories.