/
factory.go
46 lines (38 loc) · 1.17 KB
/
factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package app
import (
"sync"
openid_connect_jwt "github.com/eolinker/apinto/application/auth/openid-connect-jwt"
"github.com/eolinker/apinto/application/auth"
"github.com/eolinker/apinto/application/auth/aksk"
"github.com/eolinker/apinto/application/auth/apikey"
"github.com/eolinker/apinto/application/auth/basic"
"github.com/eolinker/apinto/application/auth/jwt"
"github.com/eolinker/apinto/application/auth/oauth2"
"github.com/eolinker/apinto/drivers"
"github.com/eolinker/apinto/drivers/app/manager"
"github.com/eolinker/eosc/common/bean"
"github.com/eolinker/eosc"
)
var name = "app"
var (
appManager manager.IManager
ones sync.Once
)
// Register 注册service_http驱动工厂
func Register(register eosc.IExtenderDriverRegister) {
register.RegisterExtenderDriver(name, NewFactory())
}
// NewFactory 创建service_http驱动工厂
func NewFactory() eosc.IExtenderDriverFactory {
ones.Do(func() {
apikey.Register()
basic.Register()
aksk.Register()
jwt.Register()
oauth2.Register()
openid_connect_jwt.Register()
appManager = manager.NewManager(auth.Alias(), auth.Keys())
bean.Injection(&appManager)
})
return drivers.NewFactory[Config](Create)
}