multiservice

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: MIT Imports: 18 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientUtilForProviderType

func NewClientUtilForProviderType(providerType OAuth2Provider) (goauth.OAuth2Util, error)

func NewClientUtilForProviderTypeString

func NewClientUtilForProviderTypeString(providerTypeString string) (goauth.OAuth2Util, error)

func RandomState

func RandomState(statePrefix string, randomSuffix bool) string

Types

type AppURLs

type AppURLs struct {
	AuthURL     string `json:"authUrl,omitempty"`
	TokenURL    string `json:"tokenUrl,omitempty"`
	RedirectURL string `json:"redirectUrl,omitempty"`
}

type ConfigMoreSet

type ConfigMoreSet struct {
	ConfigMoreMap map[string]*O2ConfigMore
}

func EnvOAuth2ConfigMap

func EnvOAuth2ConfigMap(env []osutil.EnvVar, prefix string) (*ConfigMoreSet, error)

EnvOAuth2ConfigMap returns a map of *oauth2.Config from environment variables in AppCredentialsWrapper format.

func NewConfigMoreSet

func NewConfigMoreSet() *ConfigMoreSet

func (*ConfigMoreSet) AddConfigMoreJSON added in v0.13.0

func (cfgs *ConfigMoreSet) AddConfigMoreJSON(key string, val []byte) error

func (*ConfigMoreSet) ClientURLsMap

func (cfgs *ConfigMoreSet) ClientURLsMap() map[string]AppURLs

func (*ConfigMoreSet) Get

func (cfgs *ConfigMoreSet) Get(key string) (*O2ConfigMore, error)

func (*ConfigMoreSet) Has

func (cfgs *ConfigMoreSet) Has(key string) bool

func (*ConfigMoreSet) MustGet

func (cfgs *ConfigMoreSet) MustGet(key string) *O2ConfigMore

func (*ConfigMoreSet) Slugs

func (cfgs *ConfigMoreSet) Slugs() []string

type O2ConfigMore

type O2ConfigMore struct {
	Provider                string   `json:"provider,omitempty"`
	ClientID                string   `json:"client_id,omitempty"`
	ClientSecret            string   `json:"client_secret,omitempty"`
	ProjectID               string   `json:"project_id,omitempty"`
	AuthURI                 string   `json:"auth_uri,omitempty"`
	TokenURI                string   `json:"token_uri,omitempty"`
	AuthProviderX509CertURL string   `json:"auth_provider_x509_cert_url,omitempty"`
	RedirectURIs            []string `json:"redirect_uris,omitempty"`
	JavaScriptOrigins       []string `json:"javascript_origins,omitempty"`
	Scopes                  []string `json:"scopes,omitempty"`
}

O2ConfigCanonical is similar to Google but includes scopes

func NewO2ConfigMoreFromJSON

func NewO2ConfigMoreFromJSON(bytes []byte) (*O2ConfigMore, error)

func (*O2ConfigMore) AuthURL

func (cm *O2ConfigMore) AuthURL(state string) string

func (*O2ConfigMore) Config

func (cm *O2ConfigMore) Config() *oauth2.Config

func (*O2ConfigMore) ProviderType

func (cm *O2ConfigMore) ProviderType() (OAuth2Provider, error)

func (*O2ConfigMore) RedirectURL

func (cm *O2ConfigMore) RedirectURL() string

type OAuth2Manager

type OAuth2Manager struct {
	ConfigSet *ConfigMoreSet
	TokenSet  tokens.TokenSet
}

func NewOAuth2Manager

func NewOAuth2Manager() *OAuth2Manager

func (*OAuth2Manager) GetClient

func (cb *OAuth2Manager) GetClient(ctx context.Context, serviceKey string) (*http.Client, error)

type OAuth2Provider

type OAuth2Provider int

OAuth2Provider a constant list of OAuth2 providers. Warning: do not rely on ordering or integer value as this will change as additional providers are added.

const (
	Aha OAuth2Provider = iota
	Facebook
	Google
	Instagram
	Lyft
	Metabase
	RingCentral
	SparkPost
	Twitter
	Visa
	Zendesk
)

func ProviderStringToConst

func ProviderStringToConst(s string) (OAuth2Provider, error)

ProviderStringToConst returns an OAuth2Provider type constant from a string.

func (OAuth2Provider) String

func (p OAuth2Provider) String() string

String converts a provider type to a string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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