Documentation
¶
Index ¶
Constants ¶
View Source
const ( LoginEndpoint = "/.auth/login" LogoutEndpoint = "/.auth/logout" GoogleAuthEndpoint = "/.auth/google" GoogleCallbackEndpoint = "/.auth/google/callback" GitHubAuthEndpoint = "/.auth/github" GitHubCallbackEndpoint = "/.auth/github/callback" PasswordProvider = "password" PasswordUserID = "password_user" SessionKeyProvider = "provider" SessionKeyUserID = "user_id" SessionKeyRedirectURL = "redirect_url" SessionKeyOAuthState = "oauth_state" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthRouter ¶
type AuthRouter struct {
// contains filtered or unexported fields
}
func NewAuthRouter ¶
func NewAuthRouter(passwordHash []string, providers ...Provider) (*AuthRouter, error)
func (*AuthRouter) RequireAuth ¶
func (a *AuthRouter) RequireAuth() gin.HandlerFunc
func (*AuthRouter) SetupRoutes ¶
func (a *AuthRouter) SetupRoutes(router gin.IRouter)
type Provider ¶
type Provider interface {
Name() string
RedirectURL() string
AuthURL() string
AuthCodeURL(c *gin.Context, state string) (string, error)
Exchange(c *gin.Context, state string) (*oauth2.Token, error)
GetUserID(ctx context.Context, token *oauth2.Token) (string, error)
Authorization(userid string) (bool, error)
}
func NewGithubProvider ¶
type ProviderData ¶
Click to show internal directories.
Click to hide internal directories.