rubbishclass-srv/admin/admin-handler.go

18 lines
494 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package admin
import (
"net/http"
"github.com/gin-gonic/gin"
)
//HomeHandler 基础验证试验
//HTTP基本认证(Basic Authentication)
//"用户名+冒号+密码"用BASE64算法加密后的字符串放在http request 中的header的Authorization中发送给服务端
//最终格式Authorization: Basic BASE64("用户名+冒号+密码")
// @Router /user/person/login [post]
func HomeHandler(c *gin.Context) {
user := c.MustGet(gin.AuthUserKey).(string)
c.JSON(http.StatusOK, user)
}