github

package
v3.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClaims

type AuthClaims struct {
	Token *oauth2.Token `json:"token"`
	jwt.RegisteredClaims
	User model.User `json:"user"`
}

type Cache

type Cache interface {
	Load(ctx context.Context, key string) ([]byte, error)
	Store(ctx context.Context, key string, value any, ttl time.Duration) error
	Delete(ctx context.Context, keys ...string) error
}

type Config

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

func Flags

func Flags(fs *flag.FlagSet, prefix string, overrides ...flags.Override) *Config

type ForbiddenHandler

type ForbiddenHandler func(http.ResponseWriter, *http.Request, model.User, string)

type LinkHandler added in v3.6.1

type LinkHandler func(ctx context.Context, old, new model.User) error

type Provider

type Provider interface {
	DoAtomic(ctx context.Context, action func(context.Context) error) error

	CreateGithub(ctx context.Context, invite model.User, id uint64, login string) (model.User, error)
	GetGitHubUser(ctx context.Context, id uint64) (model.User, error)

	GetInviteByToken(ctx context.Context, token string) (model.User, error)
	Delete(ctx context.Context, user model.User) error
	DeleteInvite(ctx context.Context, user model.User) error
}

type Service

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

func New

func New(config *Config, cache Cache, provider Provider, linkHandler LinkHandler, renderer *renderer.Service, cookie cookie.Service) Service

func (Service) Callback

func (s Service) Callback(w http.ResponseWriter, r *http.Request)

func (Service) GetUser

func (s Service) GetUser(ctx context.Context, r *http.Request) (model.User, error)

func (Service) Logout added in v3.5.0

func (s Service) Logout(w http.ResponseWriter, r *http.Request)

func (Service) OnUnauthorized added in v3.1.0

func (s Service) OnUnauthorized(w http.ResponseWriter, r *http.Request, err error)

func (Service) Register

func (s Service) Register(w http.ResponseWriter, r *http.Request)

type State

type State struct {
	Verifier     string `json:"verifier"`
	Registration string `json:"registration"`
	Redirection  string `json:"redirect"`
}

type User

type User struct {
	Login string `json:"login"`
	ID    uint64 `json:"id"`
}

Jump to

Keyboard shortcuts

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