summaryrefslogtreecommitdiffstats
path: root/models/oauth2.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2018-04-29 09:09:24 +0300
committerGitHub <noreply@github.com>2018-04-29 09:09:24 +0300
commit5a62eb30df3a04e76e465824f525b4ffd920b562 (patch)
treec3410d159a14a6b6d36b2ffadebbfb7dd48617f9 /models/oauth2.go
parent8d5f58d8347196fca04fdf3a22d021d09d15e37f (diff)
downloadgitea-5a62eb30df3a04e76e465824f525b4ffd920b562.tar.gz
gitea-5a62eb30df3a04e76e465824f525b4ffd920b562.zip
Store OAuth2 session data in database (#3660)
* Store OAuth2 session data in database * Rename table to `oauth2_session` and do not skip xormstorage initialization error
Diffstat (limited to 'models/oauth2.go')
-rw-r--r--models/oauth2.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/models/oauth2.go b/models/oauth2.go
index a1917540d0..0640471a48 100644
--- a/models/oauth2.go
+++ b/models/oauth2.go
@@ -97,14 +97,17 @@ func GetActiveOAuth2Providers() ([]string, map[string]OAuth2Provider, error) {
}
// InitOAuth2 initialize the OAuth2 lib and register all active OAuth2 providers in the library
-func InitOAuth2() {
- oauth2.Init()
+func InitOAuth2() error {
+ if err := oauth2.Init(x); err != nil {
+ return err
+ }
loginSources, _ := GetActiveOAuth2ProviderLoginSources()
for _, source := range loginSources {
oAuth2Config := source.OAuth2()
oauth2.RegisterProvider(source.Name, oAuth2Config.Provider, oAuth2Config.ClientID, oAuth2Config.ClientSecret, oAuth2Config.OpenIDConnectAutoDiscoveryURL, oAuth2Config.CustomURLMapping)
}
+ return nil
}
// wrapOpenIDConnectInitializeError is used to wrap the error but this cannot be done in modules/auth/oauth2