oauth

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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 NewDigitalOceanClient(cfg *Config) *oauth2.Config

func NewGithubClient

func NewGithubClient(cfg *Config) *oauth2.Config

func NewGoogleClient added in v0.3.1

func NewGoogleClient(cfg *Config) *oauth2.Config

func NewSlackClient added in v0.7.2

func NewSlackClient(cfg *Config) *oauth2.Config

Types

type Config

type Config struct {
	ClientID     string
	ClientSecret string
	Scopes       []string
	BaseURL      string
}

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

func NewGithubAppClient(cfg *Config, name string, secret string, secretPath string, appID int64) *GithubAppConf

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL