fix bug ValidateOauthProvider location

This commit is contained in:
Tao Chen
2024-11-02 04:20:00 +08:00
parent 485ae54e9e
commit c021ebfbdf
2 changed files with 4 additions and 6 deletions

View File

@@ -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)

View File

@@ -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