mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Fix creating OAuth2 auth source from CLI (#14116)
Fix creation OAuth2 auth source from CLI. Fix #8356 Co-authored-by: Daniil Pankratov <daniil.pankratov@t-systems.com>
This commit is contained in:
		| @@ -125,8 +125,18 @@ func InitOAuth2() error { | ||||
| 	if err := oauth2.Init(x); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	loginSources, _ := GetActiveOAuth2ProviderLoginSources() | ||||
| 	return initOAuth2LoginSources() | ||||
| } | ||||
|  | ||||
| // ResetOAuth2 clears existing OAuth2 providers and loads them from DB | ||||
| func ResetOAuth2() error { | ||||
| 	oauth2.ClearProviders() | ||||
| 	return initOAuth2LoginSources() | ||||
| } | ||||
|  | ||||
| // initOAuth2LoginSources is used to load and register all active OAuth2 providers | ||||
| func initOAuth2LoginSources() error { | ||||
| 	loginSources, _ := GetActiveOAuth2ProviderLoginSources() | ||||
| 	for _, source := range loginSources { | ||||
| 		oAuth2Config := source.OAuth2() | ||||
| 		err := oauth2.RegisterProvider(source.Name, oAuth2Config.Provider, oAuth2Config.ClientID, oAuth2Config.ClientSecret, oAuth2Config.OpenIDConnectAutoDiscoveryURL, oAuth2Config.CustomURLMapping) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user