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