From fe1ee461156ce60f153c7b95491d00b3c4fa09e6 Mon Sep 17 00:00:00 2001
From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
Date: Thu, 2 May 2024 11:56:27 +0200
Subject: [PATCH] V14: Unique OAuth callback route (#16194)
* set the default for `AuthorizeCallbackPathName` to "/umbraco/oauth_complete" to allow the server to redirect the user back to a route where we don't load the entire backoffice.
* remove redundant method
---
.../Configuration/Models/SecuritySettings.cs | 2 +-
.../Helpers/OAuthOptionsHelper.cs | 15 ---------------
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
index 118481b338..2a57a0a74c 100644
--- a/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
+++ b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs
@@ -25,7 +25,7 @@ public class SecuritySettings
internal const int StaticMemberDefaultLockoutTimeInMinutes = 30 * 24 * 60;
internal const int StaticUserDefaultLockoutTimeInMinutes = 30 * 24 * 60;
- internal const string StaticAuthorizeCallbackPathName = "/umbraco";
+ internal const string StaticAuthorizeCallbackPathName = "/umbraco/oauth_complete";
internal const string StaticAuthorizeCallbackLogoutPathName = "/umbraco/logout";
internal const string StaticAuthorizeCallbackErrorPathName = "/umbraco/error";
diff --git a/src/Umbraco.Web.Common/Helpers/OAuthOptionsHelper.cs b/src/Umbraco.Web.Common/Helpers/OAuthOptionsHelper.cs
index 4179819f73..803ee92b13 100644
--- a/src/Umbraco.Web.Common/Helpers/OAuthOptionsHelper.cs
+++ b/src/Umbraco.Web.Common/Helpers/OAuthOptionsHelper.cs
@@ -65,19 +65,4 @@ public class OAuthOptionsHelper
context.Response.Redirect(callbackPath);
return context;
}
-
- ///
- /// Sets the callbackPath for the RemoteAuthenticationOptions based on the configured Umbraco path and the path supplied.
- /// By default this will result in "/umbraco/your-supplied-path".
- ///
- /// The options object to set the path on.
- /// The path that should go after the umbraco path, will add a leading slash if it's missing.
- ///
- public RemoteAuthenticationOptions SetUmbracoBasedCallbackPath(RemoteAuthenticationOptions options, string path)
- {
- var umbracoCallbackPath = _securitySettings.Value.AuthorizeCallbackPathName;
-
- options.CallbackPath = umbracoCallbackPath + path.EnsureStartsWith("/");
- return options;
- }
}