auth

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchCheckRequest

type BatchCheckRequest struct {
	Checks []CheckRequest `json:"checks" binding:"required"`
}

type BatchCheckResponse

type BatchCheckResponse struct {
	Results []CheckResponse `json:"results"`
}

type CheckRequest

type CheckRequest struct {
	Resource string `json:"resource" binding:"required"`
	Action   string `json:"action" binding:"required"`
	GameID   string `json:"gameId"`
	Env      string `json:"env"`
}

type CheckResponse

type CheckResponse struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason,omitempty"`
}

type Handler

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

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) BatchCheck

func (h *Handler) BatchCheck(c *gin.Context)

func (*Handler) Check

func (h *Handler) Check(c *gin.Context)

func (*Handler) Login

func (h *Handler) Login(c *gin.Context)

Login 登录处理器

func (*Handler) Logout

func (h *Handler) Logout(c *gin.Context)

Logout 登出处理器

type LoginRequest

type LoginRequest struct {
	Username  string `json:"username" binding:"required"`
	Password  string `json:"password" binding:"required"`
	ClientIP  string `json:"-"`
	UserAgent string `json:"-"`
}

LoginRequest 登录请求

type LoginResponse

type LoginResponse struct {
	Token string   `json:"token"`
	User  UserInfo `json:"user"`
}

LoginResponse 登录响应

type LogoutRequest

type LogoutRequest struct{}

LogoutRequest 登出请求

type LogoutResponse

type LogoutResponse struct{}

LogoutResponse 登出响应

type Service

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

func NewService

func NewService(adminModel *model.AdminModel, permSvc *permissionservice.PermissionService, opsStore ...*svc.OpsStateStore) *Service

func (*Service) BatchCheck

func (s *Service) BatchCheck(ctx context.Context, username string, req *BatchCheckRequest) (*BatchCheckResponse, error)

func (*Service) Check

func (s *Service) Check(ctx context.Context, username string, req *CheckRequest) (*CheckResponse, error)

func (*Service) Login

func (s *Service) Login(ctx context.Context, req *LoginRequest) (*LoginResponse, error)

Login 用户登录

func (*Service) Logout

func (s *Service) Logout(ctx context.Context, req *LogoutRequest) (*LogoutResponse, error)

Logout 用户登出

type UserInfo

type UserInfo struct {
	Username string   `json:"username"`
	Nickname string   `json:"nickname"`
	Roles    []string `json:"roles"`
}

UserInfo 用户信息

Jump to

Keyboard shortcuts

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