auth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client 深信服防火墙认证客户端

func NewClient

func NewClient(host string) *Client

NewClient 创建新的认证客户端

func (*Client) Login

func (c *Client) Login(username, password string) (*LoginResponse, error)

Login 执行登录操作

type LoginRequest

type LoginRequest struct {
	Name     string `json:"name"`
	Password string `json:"password"`
}

LoginRequest 登录请求

type LoginResponse

type LoginResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Name        string `json:"name"`
		Role        string `json:"role"`
		Namespace   string `json:"namespace"`
		LoginResult struct {
			Token string `json:"token"`
		} `json:"loginResult"`
	} `json:"data"`
	Token  string `json:"token,omitempty"`
	SESSID string `json:"sessid,omitempty"` // 会话ID,从响应Cookie中提取
}

LoginResponse 登录响应

func (*LoginResponse) GetSESSID

func (r *LoginResponse) GetSESSID() string

GetSESSID 获取SESSID(用于后续API调用)

func (*LoginResponse) GetToken

func (r *LoginResponse) GetToken() string

GetToken 获取token(用于后续API调用)

func (*LoginResponse) IsSuccess

func (r *LoginResponse) IsSuccess() bool

IsSuccess 检查登录是否成功

Jump to

Keyboard shortcuts

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