From c642a860cac9c8065492df6170987a56a756dc04 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sat, 20 Jan 2024 13:16:06 +0200 Subject: [PATCH] rename local const redirect path vars for consistency --- apis/record_auth.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apis/record_auth.go b/apis/record_auth.go index 1c4f3d0e..aed9619e 100644 --- a/apis/record_auth.go +++ b/apis/record_auth.go @@ -658,8 +658,8 @@ func (api *recordAuthApi) unlinkExternalAuth(c echo.Context) error { const ( oauth2SubscriptionTopic string = "@oauth2" - oauth2FailureRedirectPath string = "../_/#/auth/oauth2-redirect-failure" - oauth2SuccessRedirectPath string = "../_/#/auth/oauth2-redirect-success" + oauth2RedirectFailurePath string = "../_/#/auth/oauth2-redirect-failure" + oauth2RedirectSuccessPath string = "../_/#/auth/oauth2-redirect-success" ) type oauth2EventMessage struct { @@ -672,13 +672,13 @@ func (api *recordAuthApi) oauth2SubscriptionRedirect(c echo.Context) error { state := c.QueryParam("state") if state == "" { api.app.Logger().Debug("Missing OAuth2 state parameter") - return c.Redirect(http.StatusTemporaryRedirect, oauth2FailureRedirectPath) + return c.Redirect(http.StatusTemporaryRedirect, oauth2RedirectFailurePath) } client, err := api.app.SubscriptionsBroker().ClientById(state) if err != nil || client.IsDiscarded() || !client.HasSubscription(oauth2SubscriptionTopic) { api.app.Logger().Debug("Missing or invalid OAuth2 subscription client", "error", err, "clientId", state) - return c.Redirect(http.StatusTemporaryRedirect, oauth2FailureRedirectPath) + return c.Redirect(http.StatusTemporaryRedirect, oauth2RedirectFailurePath) } defer client.Unsubscribe(oauth2SubscriptionTopic) @@ -691,7 +691,7 @@ func (api *recordAuthApi) oauth2SubscriptionRedirect(c echo.Context) error { encodedData, err := json.Marshal(data) if err != nil { api.app.Logger().Debug("Failed to marshalize OAuth2 redirect data", "error", err) - return c.Redirect(http.StatusTemporaryRedirect, oauth2FailureRedirectPath) + return c.Redirect(http.StatusTemporaryRedirect, oauth2RedirectFailurePath) } msg := subscriptions.Message{ @@ -703,8 +703,8 @@ func (api *recordAuthApi) oauth2SubscriptionRedirect(c echo.Context) error { if data.Error != "" || data.Code == "" { api.app.Logger().Debug("Failed OAuth2 redirect due to an error or missing code parameter", "error", data.Error, "clientId", data.State) - return c.Redirect(http.StatusTemporaryRedirect, oauth2FailureRedirectPath) + return c.Redirect(http.StatusTemporaryRedirect, oauth2RedirectFailurePath) } - return c.Redirect(http.StatusTemporaryRedirect, oauth2SuccessRedirectPath) + return c.Redirect(http.StatusTemporaryRedirect, oauth2RedirectSuccessPath) }