From c021ebfbdff4c82b7dccc554051deb77247fa612 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Sat, 2 Nov 2024 04:20:00 +0800 Subject: [PATCH] fix bug ValidateOauthProvider location --- http/controller/api/ouath.go | 6 ------ service/oauth.go | 4 ++++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/http/controller/api/ouath.go b/http/controller/api/ouath.go index 5367117..5f2867f 100644 --- a/http/controller/api/ouath.go +++ b/http/controller/api/ouath.go @@ -32,12 +32,6 @@ func (o *Oauth) OidcAuth(c *gin.Context) { } oauthService := service.AllService.OauthService - err = oauthService.ValidateOauthProvider(f.Op) - if err != nil { - response.Error(c, response.TranslateMsg(c, err.Error())) - return - } - var code string var url string err, code, url = oauthService.BeginAuth(f.Op) diff --git a/service/oauth.go b/service/oauth.go index c28eec5..446f61c 100644 --- a/service/oauth.go +++ b/service/oauth.go @@ -155,6 +155,10 @@ func (os *OauthService) FetchOidcEndpointByOp(op string) (error, OidcEndpoint) { // GetOauthConfig retrieves the OAuth2 configuration based on the provider name func (os *OauthService) GetOauthConfig(op string) (err error, oauthType string, oauthConfig *oauth2.Config) { + err = os.ValidateOauthProvider(op) + if err != nil { + return err, "", nil + } err, oauthType, oauthConfig = os.getOauthConfigGeneral(op) if err != nil { return err, oauthType, nil