Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OauthRedirector ¶
Types ¶
type BaseOAuth2 ¶
type BaseOAuth2 struct {
ClientId string
ClientSecret string
CallbackURL string
HandleUser HandleUserFunc
AuthFailureUrl string
// HTTPClient is used for making HTTP requests during OAuth flows.
// If nil, http.DefaultClient is used. This can be set for testing.
HTTPClient *http.Client
// contains filtered or unexported fields
}
func NewBaseOAuth2 ¶
func NewBaseOAuth2(clientId string, clientSecret string, callbackUrl string, handleUser HandleUserFunc) *BaseOAuth2
func (*BaseOAuth2) ExchangeContext ¶ added in v0.0.18
func (b *BaseOAuth2) ExchangeContext() context.Context
ExchangeContext returns a context configured with the HTTP client for token exchange
func (*BaseOAuth2) Handler ¶ added in v0.0.2
func (b *BaseOAuth2) Handler() http.Handler
func (*BaseOAuth2) SetHTTPClient ¶ added in v0.0.18
func (b *BaseOAuth2) SetHTTPClient(client *http.Client)
SetHTTPClient sets the HTTP client used for OAuth requests. This is primarily used for testing with mock servers.
func (*BaseOAuth2) SetOAuthEndpoint ¶ added in v0.0.18
func (b *BaseOAuth2) SetOAuthEndpoint(endpoint oauth2.Endpoint)
SetOAuthEndpoint sets the OAuth endpoint (auth URL and token URL). This is primarily used for testing with mock servers.
type GithubOAuth2 ¶
type GithubOAuth2 struct {
*BaseOAuth2
// UserInfoURL is the URL to fetch user info from. Defaults to GitHub's API.
// Can be overridden for testing.
UserInfoURL string
}
func NewGithubOAuth2 ¶
func NewGithubOAuth2(clientId string, clientSecret string, callbackUrl string, handleUser HandleUserFunc) *GithubOAuth2
type GoogleOAuth2 ¶
type GoogleOAuth2 struct {
*BaseOAuth2
// UserInfoURL is the URL to fetch user info from. Defaults to Google's API.
// Can be overridden for testing.
UserInfoURL string
}
func NewGoogleOAuth2 ¶
func NewGoogleOAuth2(clientId string, clientSecret string, callbackUrl string, handleUser HandleUserFunc) *GoogleOAuth2
Click to show internal directories.
Click to hide internal directories.