auth

package
v0.0.0-...-2c51fd6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GITHUB            = "github"
	GithubUserinfoUrl = "https://api.github.com/user"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func NewAuth

func NewAuth(config *config.Server, logger *zap.Logger, svc *service.Service) *Auth

func (*Auth) GetOAuthByName

func (a *Auth) GetOAuthByName(ctx context.Context, name string) (OAuth, error)

func (*Auth) Providers

func (a *Auth) Providers(_ context.Context) ([]string, error)

type OAuth

type OAuth interface {
	LoginByCode(ctx context.Context, code string, autoRegister bool) (*User, error)
	AuthorizeUrl(ctx context.Context) string
}

type User

type User struct {
	ID          string      `json:"id"`
	Name        string      `json:"name"`
	Avatar      string      `json:"avatar"`
	Description string      `json:"description"`
	Role        domain.Role `json:"role"`
	Token       string      `json:"token"`
	ExpireAt    int64       `json:"expire_at"`
}

Jump to

Keyboard shortcuts

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