From e2882b64366567ff1d4584d8348d6373612c3f28 Mon Sep 17 00:00:00 2001 From: Krzysztof Jagosz Date: Tue, 29 Apr 2025 14:46:18 +0200 Subject: [PATCH] Some cleanup for unused things --- src/mod/auth/sso/oauth2/oauth2.go | 13 +------------ src/web/components/sso.html | 9 +-------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/mod/auth/sso/oauth2/oauth2.go b/src/mod/auth/sso/oauth2/oauth2.go index e036d6f..449c44e 100644 --- a/src/mod/auth/sso/oauth2/oauth2.go +++ b/src/mod/auth/sso/oauth2/oauth2.go @@ -16,7 +16,6 @@ import ( type OAuth2RouterOptions struct { OAuth2ServerURL string //The URL of the OAuth 2.0 server server OAuth2TokenURL string //The URL of the OAuth 2.0 token server - OAuth2RedirectUrl string //The redirect URL of the OAuth 2.0 token server OAuth2ClientId string //The client id for OAuth 2.0 Application OAuth2ClientSecret string //The client secret for OAuth 2.0 Application OAuth2WellKnownUrl string //The well-known url for OAuth 2.0 server @@ -56,7 +55,6 @@ func NewOAuth2Router(options *OAuth2RouterOptions) *OAuth2Router { options.Database.Read("oauth2", "oauth2TokenUrl", &options.OAuth2TokenURL) options.Database.Read("oauth2", "oauth2ClientId", &options.OAuth2ClientId) options.Database.Read("oauth2", "oauth2ClientSecret", &options.OAuth2ClientSecret) - options.Database.Read("oauth2", "oauth2RedirectURL", &options.OAuth2RedirectUrl) options.Database.Read("oauth2", "oauth2UserInfoUrl", &options.OAuth2UserInfoUrl) options.Database.Read("oauth2", "oauth2Scopes", &options.OAuth2Scopes) @@ -73,10 +71,9 @@ func (ar *OAuth2Router) HandleSetOAuth2Settings(w http.ResponseWriter, r *http.R "oauth2WellKnownUrl": ar.options.OAuth2WellKnownUrl, "oauth2ServerUrl": ar.options.OAuth2ServerURL, "oauth2TokenUrl": ar.options.OAuth2TokenURL, + "oauth2UserInfoUrl": ar.options.OAuth2UserInfoUrl, "oauth2Scopes": ar.options.OAuth2Scopes, "oauth2ClientSecret": ar.options.OAuth2ClientSecret, - "oauth2RedirectURL": ar.options.OAuth2RedirectUrl, - "oauth2UserInfoURL": ar.options.OAuth2UserInfoUrl, "oauth2ClientId": ar.options.OAuth2ClientId, }) @@ -112,12 +109,6 @@ func (ar *OAuth2Router) HandleSetOAuth2Settings(w http.ResponseWriter, r *http.R } } - oauth2RedirectUrl, err := utils.PostPara(r, "oauth2RedirectUrl") - if err != nil { - utils.SendErrorResponse(w, "oauth2RedirectUrl not found") - return - } - oauth2ClientId, err := utils.PostPara(r, "oauth2ClientId") if err != nil { utils.SendErrorResponse(w, "oauth2ClientId not found") @@ -134,7 +125,6 @@ func (ar *OAuth2Router) HandleSetOAuth2Settings(w http.ResponseWriter, r *http.R ar.options.OAuth2WellKnownUrl = oauth2WellKnownUrl ar.options.OAuth2ServerURL = oauth2ServerUrl ar.options.OAuth2TokenURL = oauth2TokenURL - ar.options.OAuth2RedirectUrl = oauth2RedirectUrl ar.options.OAuth2UserInfoUrl = oauth2UserInfoUrl ar.options.OAuth2ClientId = oauth2ClientId ar.options.OAuth2ClientSecret = oauth2ClientSecret @@ -144,7 +134,6 @@ func (ar *OAuth2Router) HandleSetOAuth2Settings(w http.ResponseWriter, r *http.R ar.options.Database.Write("oauth2", "oauth2WellKnownUrl", oauth2WellKnownUrl) ar.options.Database.Write("oauth2", "oauth2ServerUrl", oauth2ServerUrl) ar.options.Database.Write("oauth2", "oauth2TokenUrl", oauth2TokenURL) - ar.options.Database.Write("oauth2", "oauth2RedirectUrl", oauth2RedirectUrl) ar.options.Database.Write("oauth2", "oauth2UserInfoUrl", oauth2UserInfoUrl) ar.options.Database.Write("oauth2", "oauth2ClientId", oauth2ClientId) ar.options.Database.Write("oauth2", "oauth2ClientSecret", oauth2ClientSecret) diff --git a/src/web/components/sso.html b/src/web/components/sso.html index 5061ebc..981afea 100644 --- a/src/web/components/sso.html +++ b/src/web/components/sso.html @@ -68,13 +68,7 @@
- - - URL used by the OAuth2 provider to redirect the user after successful authentication. Should be set to your Zoraxy instance URL -
- -
- + URL used by the OAuth2 provider to validate generated token. Optional if Well-Known url is configured.
@@ -145,7 +139,6 @@ $('#oauth2WellKnownUrl').val(data.oauth2WellKnownUrl); $('#oauth2ServerUrl').val(data.oauth2ServerUrl); $('#oauth2TokenUrl').val(data.oauth2TokenUrl); - $('#oauth2RedirectUrl').val(data.oauth2RedirectUrl); $('#oauth2UserInfoUrl').val(data.oauth2UserInfoUrl); $('#oauth2ClientId').val(data.oauth2ClientId); $('#oauth2ClientSecret').val(data.oauth2ClientSecret);