auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderIdentity = contextKeyType("x-userinfo")
View Source
const KeyIdentity = contextKeyType("authorization")

Variables

This section is empty.

Functions

func AuthorizationFromContext

func AuthorizationFromContext(ctx context.Context) string

func IsAuthorized

func IsAuthorized(ctx context.Context, optionalId string) bool

func PreAuthorize

func PreAuthorize(c *gin.Context) *http.Request

Types

type Identity

type Identity struct {
	Email    string
	Name     string
	UserName string
	Raw      string
	// contains filtered or unexported fields
}

func Authorize

func Authorize(ctx context.Context, optionalId string, hook func(context.Context, *Identity) *Identity) (context.Context, *Identity, error)

func IdentityFromContext

func IdentityFromContext(ctx context.Context) *Identity

IdentityFromContext 如果userInfoKey不存在,返回结果为nil

func NewIdentity

func NewIdentity(email, name, username, raw string) *Identity

func (*Identity) Authenticated

func (i *Identity) Authenticated(id string) *Identity

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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