2022-05-18 17:57:03 +08:00
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
2022-05-29 10:06:21 +08:00
|
|
|
"github.com/eryajf/go-ldap-admin/controller"
|
2022-05-18 17:57:03 +08:00
|
|
|
|
|
|
|
jwt "github.com/appleboy/gin-jwt/v2"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 注册基础路由
|
|
|
|
func InitBaseRoutes(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) gin.IRoutes {
|
|
|
|
base := r.Group("/base")
|
|
|
|
{
|
|
|
|
base.GET("ping", controller.Demo)
|
2022-07-05 12:16:05 +08:00
|
|
|
base.GET("getpasswd", controller.Base.GetPasswd) // 将明文字符串转为MySQL识别的密码
|
2022-05-18 17:57:03 +08:00
|
|
|
// 登录登出刷新token无需鉴权
|
|
|
|
base.POST("/login", authMiddleware.LoginHandler)
|
|
|
|
base.POST("/logout", authMiddleware.LogoutHandler)
|
|
|
|
base.POST("/refreshToken", authMiddleware.RefreshHandler)
|
|
|
|
base.POST("/changePwd", controller.Base.ChangePwd) // 修改用户密码
|
|
|
|
base.GET("/dashboard", controller.Base.Dashboard) // 系统首页展示数据
|
|
|
|
}
|
|
|
|
return r
|
|
|
|
}
|