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
}
func (*Auth) Bind ¶
func (h *Auth) Bind(rg *gin.RouterGroup, jwtHandler *jwt.GinJWTMiddleware, options *services.Options) error
@Summary User Authentication @Description In restricted mode, the client must log in to access other APIs. This API is used to checks the server's authentication status, issues an RSA public key for credential encryption, generates a captcha, authenticates the client, and signs or refreshes the JWT token. This API requires a valid JWT token if action is `refresh`. @Router /auth [post] @Produce application/json @Security ApiKeyAuth @Param action formData string true "Specifies the action to be performed. Use `inspect` to check the server's restriction status, `preauth` to get a Base64 RSA public key in PEM format and generate a Base64 captcha PNG image, `login` to authenticate the client using encrypted credentials, and `refresh` to refresh the JWT token." @Param nonce formData string false "A unique string used to prevent replay attacks, required for the `login` action and left empty for other actions. The nonce is the SHA-1 hash of the RSA public key from the pre-authentication stage and becomes invalid once the request is sent. It also expires if unused within the time-to-live (TTL) period, which is set during the pre-authentication stage." @Param credential formData string false "Base64 encrypted credential using the RSA public key, required for the `login` action and left empty for other actions. The decrypted credential is a JSON object that includes the username, password, captcha ID, and captcha solution. Example: `{ username: admin, password: admin, captcha_id: 123, captcha_solution: abc }`." @Param Authorization header string false "Bearer JWT token, only required for the `refresh` action."