jwtserver

package
v0.0.0-...-865f097 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestroyToken

func DestroyToken(ctx context.Context, s *server.Server, redisClient redis.UniversalClient, userID ...string)

DestroyToken destroy token by userID

func GetUserDEPIDs

func GetUserDEPIDs(deps [][]org.DepOneResponse) [][]string

GetUserDEPIDs get org dep slice

func GetUserInfo

func GetUserInfo(ctx context.Context, u org.User, redisClient redis.UniversalClient, header http.Header, userID string, conf configs.Config) (info *org.OneUserResponse, depID string, err error)

GetUserInfo get user info

func NewServer

func NewServer() *server.Server

NewServer 初始化

Types

type CheckTokenResponse

type CheckTokenResponse struct {
	UserID   string
	Name     string
	DepID    string
	TenantID string
}

CheckTokenResponse check token response

type DestroyTokenRequest

type DestroyTokenRequest struct {
	UsersID []string `json:"usersID"`
}

DestroyTokenRequest 接收用户id数组

type DestroyTokenResponse

type DestroyTokenResponse struct {
}

DestroyTokenResponse 接收用户id数组

type FaasCheckReq

type FaasCheckReq struct {
	Token string
}

FaasCheckReq FaasCheckReq

type FaasCheckResp

type FaasCheckResp struct {
	Code int
}

FaasCheckResp FaasCheckResp

type JWTServer

type JWTServer interface {
	Login(ctx context.Context, r *LoginRequst) (*LoginResponse, error)
	Logout(ctx context.Context, tokenString string) (string, error)
	Refresh(ctx context.Context, refreshToken string) (interface{}, error)
	DestroyByUserID(ctx context.Context, req *DestroyTokenRequest) (*DestroyTokenResponse, error)
	CheckToken(c context.Context, header http.Header, token string) (response *CheckTokenResponse, err error)
	Auth(c context.Context, header http.Header, token string) (interface{}, error)
	FaasCheck(c context.Context, req *FaasCheckReq) (*FaasCheckResp, error)
	SwitchTenant(c context.Context, req *SwitchTenantRequest) (*SwitchTenantResponse, error)
}

JWTServer interface

func NewJWTImpl

func NewJWTImpl(conf configs.Config, redisClient redis.UniversalClient) (JWTServer, error)

NewJWTImpl 初始化

type LoginRequst

type LoginRequst struct {
	UserName  string `json:"username" binding:"required"`
	Password  string `json:"password" binding:"required"`
	LoginType string `json:"login_type" binding:"required"`
}

LoginRequst LoginRequst

type LoginResponse

type LoginResponse struct {
	Token map[string]interface{}
}

LoginResponse response

type OrgCheckRequest

type OrgCheckRequest struct {
	UserName string `json:"username"` //多形态:邮箱、手机、其它
	Password string `json:"password"`
	Types    string `json:"types"` //登录模式
}

OrgCheckRequest 用于调用org服务

type OrgCheckResponse

type OrgCheckResponse struct {
	UserID    string `json:"userID"`
	UseStatus int    `json:"useStatus"` //状态:1正常,-2禁用,-1删除 (与账号库相同)
	Code      int64  `json:"code"`      //错误码
	Msg       string `json:"msg"`       //错误信息
}

OrgCheckResponse 返回用户信息

type SwitchTenantRequest

type SwitchTenantRequest struct {
	UserID   string
	TenantID string `json:"tenantID"`
	Token    string
}

SwitchTenantRequest switch tenant request

type SwitchTenantResponse

type SwitchTenantResponse struct {
}

SwitchTenantResponse switch tenant response

Jump to

Keyboard shortcuts

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