oauth

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Providers = map[string]oauthProvider{
	"github": GitHubOAuth{
		AuthURL:  "https://github.com/login/oauth/authorize",
		TokenURL: "https://github.com/login/oauth/access_token",
	},
	"google": GoogleOAuth{
		AuthURL:  "https://accounts.google.com/o/oauth2/auth",
		TokenURL: "https://accounts.google.com/o/oauth2/token",
	},
	"oidc": &OIDCOAuth{},
}

Functions

This section is empty.

Types

type GitHubOAuth

type GitHubOAuth struct {
	AuthURL  string
	TokenURL string
}

func (GitHubOAuth) GetRedirectURL

func (g GitHubOAuth) GetRedirectURL(req *RedirectURIRequest) string

func (GitHubOAuth) GetScope

func (g GitHubOAuth) GetScope() (ScopeName, ScopeValue)

func (GitHubOAuth) GetToken added in v0.5.0

func (g GitHubOAuth) GetToken(ctx context.Context, req *TokenRequest) (*http.Response, error)

func (GitHubOAuth) GetUserInfo added in v0.5.0

func (g GitHubOAuth) GetUserInfo(ctx context.Context, response TokenResponse) (*UserInfoResponse, error)

func (GitHubOAuth) Prepare added in v0.4.0

func (g GitHubOAuth) Prepare(_ context.Context, _ *PrepareRequest) error

type GoogleOAuth

type GoogleOAuth struct {
	AuthURL  string
	TokenURL string
}

func (GoogleOAuth) GetRedirectURL

func (g GoogleOAuth) GetRedirectURL(req *RedirectURIRequest) string

func (GoogleOAuth) GetScope

func (g GoogleOAuth) GetScope() (ScopeName, ScopeValue)

func (GoogleOAuth) GetToken added in v0.5.0

func (g GoogleOAuth) GetToken(ctx context.Context, req *TokenRequest) (*http.Response, error)

func (GoogleOAuth) GetUserInfo added in v0.5.0

func (g GoogleOAuth) GetUserInfo(ctx context.Context, response TokenResponse) (*UserInfoResponse, error)

func (GoogleOAuth) Prepare added in v0.4.0

func (g GoogleOAuth) Prepare(_ context.Context, _ *PrepareRequest) error

type GrantType added in v0.4.0

type GrantType string

func (GrantType) String added in v0.4.0

func (gt GrantType) String() string

type OIDCOAuth added in v0.4.0

type OIDCOAuth struct {
	AuthURL     string `json:"authorization_endpoint"`
	TokenURL    string `json:"token_endpoint"`
	UserInfoURL string `json:"userinfo_endpoint"`

	Scopes       []ScopeValue   `json:"scopes_supported"`
	ResponseType []ResponseType `json:"response_types_supported"`
	GrantType    []GrantType    `json:"grant_types_supported"`

	ConfigurationURL string
}

func (*OIDCOAuth) GetRedirectURL added in v0.4.0

func (o *OIDCOAuth) GetRedirectURL(req *RedirectURIRequest) string

func (*OIDCOAuth) GetScope added in v0.4.0

func (o *OIDCOAuth) GetScope() (ScopeName, ScopeValue)

func (*OIDCOAuth) GetToken added in v0.5.0

func (o *OIDCOAuth) GetToken(ctx context.Context, req *TokenRequest) (*http.Response, error)

func (*OIDCOAuth) GetUserInfo added in v0.5.0

func (o *OIDCOAuth) GetUserInfo(ctx context.Context, response TokenResponse) (*UserInfoResponse, error)

func (*OIDCOAuth) Prepare added in v0.4.0

func (o *OIDCOAuth) Prepare(ctx context.Context, req *PrepareRequest) error

type PrepareRequest added in v0.5.0

type PrepareRequest struct {
	// contains filtered or unexported fields
}

func NewPrepareRequest added in v0.5.0

func NewPrepareRequest(cURL string) *PrepareRequest

type RedirectURIRequest added in v0.5.0

type RedirectURIRequest struct {
	// contains filtered or unexported fields
}

func NewRedirectURIRequest added in v0.5.0

func NewRedirectURIRequest(clientID string, redirectURI string) *RedirectURIRequest

type ResponseType added in v0.4.0

type ResponseType string

func (ResponseType) String added in v0.4.0

func (rt ResponseType) String() string

type ScopeName added in v0.4.0

type ScopeName string

func (ScopeName) String added in v0.4.0

func (sn ScopeName) String() string

type ScopeValue added in v0.4.0

type ScopeValue string

func (ScopeValue) String added in v0.4.0

func (sv ScopeValue) String() string

type TokenRequest added in v0.5.0

type TokenRequest struct {
	// contains filtered or unexported fields
}

func NewTokenRequest added in v0.5.0

func NewTokenRequest(clientID string, clientSecret string, code string, redirectURI string) *TokenRequest

type TokenResponse added in v0.5.0

type TokenResponse []byte

type UserInfoResponse added in v0.5.0

type UserInfoResponse struct {
	UID      string
	Email    string
	Username string
}

Jump to

Keyboard shortcuts

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