|
|
@@ -3,7 +3,6 @@ package service
|
|
|
import (
|
|
|
"git.sxidc.com/go-framework/baize/convenient/domain/auth"
|
|
|
"git.sxidc.com/go-framework/baize/convenient/domain/auth/middlewares"
|
|
|
- "git.sxidc.com/go-framework/baize/framework/binding"
|
|
|
"git.sxidc.com/go-framework/baize/framework/core/api"
|
|
|
"git.sxidc.com/go-framework/baize/framework/core/application"
|
|
|
"git.sxidc.com/go-framework/baize/framework/core/infrastructure"
|
|
|
@@ -20,8 +19,6 @@ var authService = &AuthService{}
|
|
|
type AuthService struct{}
|
|
|
|
|
|
func (svc *AuthService) Init(appInstance *application.App) error {
|
|
|
- // TODO 初始化超管用户
|
|
|
-
|
|
|
svc.prefixRoot(appInstance)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -31,13 +28,12 @@ func (svc *AuthService) Destroy() error {
|
|
|
}
|
|
|
|
|
|
func (svc *AuthService) prefixRoot(appInstance *application.App) {
|
|
|
- prefixRootBinder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, ""), appInstance.Infrastructure())
|
|
|
-
|
|
|
- auth.BindAuth(prefixRootBinder, &auth.Simple{
|
|
|
- Schema: dbSchema,
|
|
|
- AESKey: aesKey,
|
|
|
- JWTSecretKey: jwtSecretKey,
|
|
|
- JWTExpiredSec: 24 * 3600,
|
|
|
- AuthMiddleware: middlewares.Authentication(dbSchema, jwtSecretKey),
|
|
|
+ auth.BindAuth(appInstance, &auth.Simple{
|
|
|
+ Schema: dbSchema,
|
|
|
+ AESKey: aesKey,
|
|
|
+ JWTSecretKey: jwtSecretKey,
|
|
|
+ JWTExpiredSec: 24 * 3600,
|
|
|
+ AuthMiddleware: middlewares.Authentication(dbSchema, jwtSecretKey),
|
|
|
+ AdminUserPassword: "123456",
|
|
|
})
|
|
|
}
|