github

package
v3.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 18 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 Provider

type Provider interface {
	GetGitHubUser(ctx context.Context, id uint64, registration string) (model.User, error)
	UpdateGitHubUser(ctx context.Context, user model.User, githubID, githubLogin string) (model.User, error)
}

type Service

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

func New

func New(config *Config, cache Cache, provider Provider, 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) 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