http

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenNotInit = errors.New("token not initialized")
	ErrInvalidToken = errors.New("invalid token")
)

Functions

func AddSocialAccountHandler

func AddSocialAccountHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func Init

func Init(i, a string, secret []byte)

func OTPVerifyHandler

func OTPVerifyHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func ParseToken

func ParseToken(ctx *gin.Context, claims jwt.Claims) error

func RefreshHandler

func RefreshHandler(c *gin.Context)

func RegisterHandler

func RegisterHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func RegisterPasskeyHandler

func RegisterPasskeyHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func SignInHandler

func SignInHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

func UserHandler added in v1.0.1

func UserHandler(endpoint endpoint.Endpoint) gin.HandlerFunc

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	Roles []string `json:"roles"`
}

func (*Claims) Map

func (c *Claims) Map() map[string]any

type GinAuth

type GinAuth func(rule string, who ...Who) gin.HandlerFunc

func Authorizator

func Authorizator(policy policy.Policy) GinAuth

type Who

type Who byte
const (
	Owner Who = 1 << iota
	Group
	Others
	Admin
	All
)

Jump to

Keyboard shortcuts

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