auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth 企业微信网页授权登录

func NewAuth

func NewAuth(account contracts.AccountInterface) *Auth

func (*Auth) AuthUrl

func (auth *Auth) AuthUrl() string

AuthUrl 构造授权链接

func (*Auth) GetUserDetail

func (auth *Auth) GetUserDetail(userTicket string) (*UserDetail, error)

GetUserDetail 获取用户敏感信息

func (*Auth) QrLoginRedirect

func (auth *Auth) QrLoginRedirect(writer http.ResponseWriter, request *http.Request, loginType string)

QrLoginRedirect 302重定向到扫码登录页

func (*Auth) QrLoginUrl

func (auth *Auth) QrLoginUrl(loginType string) string

QrLoginUrl 构造企业微信扫码登录链接

func (*Auth) Redirect

func (auth *Auth) Redirect(writer http.ResponseWriter, request *http.Request)

Redirect 302重定向到授权页

func (*Auth) TFA

func (auth *Auth) TFA() *Tfa

TFA 二次验证

func (*Auth) UserFromCode

func (auth *Auth) UserFromCode(code string) (*UserIdentity, error)

UserFromCode 通过code获取用户身份

func (*Auth) WithAgentId

func (auth *Auth) WithAgentId(agentId string) *Auth

WithAgentId 设置agentid

func (*Auth) WithRedirectUrl

func (auth *Auth) WithRedirectUrl(redirectUrl string) *Auth

WithRedirectUrl 设置回调URL

func (*Auth) WithScope

func (auth *Auth) WithScope(scope string) *Auth

WithScope 设置授权作用域

func (*Auth) WithState

func (auth *Auth) WithState(state string) *Auth

WithState 设置state参数

type Tfa

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

Tfa 二次验证

func NewTfa

func NewTfa(account contracts.AccountInterface) *Tfa

func (*Tfa) AuthSucc

func (t *Tfa) AuthSucc(userid string) error

AuthSucc 登录二次验证

func (*Tfa) GetTfaInfo

func (t *Tfa) GetTfaInfo(code string) (*TfaInfo, error)

GetTfaInfo 获取用户二次验证信息(通过code获取userid和tfa_code)

func (*Tfa) TfaSucc

func (t *Tfa) TfaSucc(userid string, tfaCode string) error

TfaSucc 使用二次验证

type TfaInfo

type TfaInfo struct {
	Userid  string `json:"userid"`
	TfaCode string `json:"tfa_code"`
}

TfaInfo 成员二次验证信息

type UserDetail

type UserDetail struct {
	UserId  string `json:"userid"`
	Gender  string `json:"gender"`
	Avatar  string `json:"avatar"`
	QrCode  string `json:"qr_code"`
	Mobile  string `json:"mobile"`
	Email   string `json:"email"`
	BizMail string `json:"biz_mail"`
	Address string `json:"address"`
}

UserDetail 用户敏感信息

type UserIdentity

type UserIdentity struct {
	UserId     string `json:"UserId"`
	OpenId     string `json:"OpenId"`
	DeviceId   string `json:"DeviceId"`
	UserTicket string `json:"user_ticket"`
	ExpiresIn  int    `json:"expires_in"`
}

UserIdentity 用户身份信息

Jump to

Keyboard shortcuts

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