auth

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

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"
)

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(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) (string, error)
	Exchange(c *gin.Context) (*oauth2.Token, error)
	GetUserID(ctx context.Context, token *oauth2.Token) (string, error)
	Authorization(userid string) (bool, error)
}

func NewGithubProvider

func NewGithubProvider(clientID, clientSecret, externalURL string, allowedUsers []string) (Provider, error)

func NewGoogleProvider

func NewGoogleProvider(externalURL, clientID, clientSecret string, allowedUsers []string) (Provider, error)

type ProviderData

type ProviderData struct {
	Name string
	URL  string
}

Jump to

Keyboard shortcuts

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