This commit is contained in:
eson
2023-07-27 10:18:49 +08:00
parent 01cc7da3b4
commit 19ad6625e6
12 changed files with 301 additions and 85 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"fusenapi/fsm"
"fusenapi/server/auth/internal/config"
"fusenapi/utils/auth"
"fusenapi/utils/autoconfig"
"net/http"
@@ -21,6 +22,8 @@ type ServiceContext struct {
MysqlConn *gorm.DB
AllModels *gmodel.AllModelsGen
TokenManger *auth.ConfirmationLink[auth.RegisterToken]
}
func NewServiceContext(c config.Config) *ServiceContext {
@@ -32,6 +35,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
MysqlConn: conn,
SharedState: StateServer,
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
TokenManger: auth.NewConfirmationLink[auth.RegisterToken]([]byte(c.Auth.AccessSecret), "http://localhost:9900/api/auth/oauth2/register"),
}
}