-
Notifications
You must be signed in to change notification settings - Fork 0
/
other.go
33 lines (30 loc) · 821 Bytes
/
other.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
package initialize
import (
"github.com/ve-weiyi/ve-blog-golang/kit/infra/oauth"
"github.com/ve-weiyi/ve-blog-golang/kit/infra/oauth/feishu"
"github.com/ve-weiyi/ve-blog-golang/kit/infra/oauth/qq"
"github.com/ve-weiyi/ve-blog-golang/kit/infra/oauth/weibo"
"github.com/ve-weiyi/ve-blog-golang/server/config"
)
func InitOauth(c map[string]config.OauthConf) map[string]oauth.Oauth {
var om = make(map[string]oauth.Oauth)
for k, v := range c {
conf := &oauth.AuthConfig{
ClientId: v.ClientId,
ClientSecret: v.ClientSecret,
RedirectUri: v.RedirectUri,
}
switch k {
case "qq":
auth := qq.NewAuthQq(conf)
om["qq"] = auth
case "weibo":
auth := weibo.NewAuthWb(conf)
om["weibo"] = auth
case "feishu":
auth := feishu.NewAuthFeishu(conf)
om["feishu"] = auth
}
}
return om
}