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) }