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
This commit is contained in:
Jacob Overgaard
2024-05-02 11:56:27 +02:00
committed by GitHub
parent 2009989f6a
commit fe1ee46115
2 changed files with 1 additions and 16 deletions

View File

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

View File

@@ -65,19 +65,4 @@ public class OAuthOptionsHelper
context.Response.Redirect(callbackPath);
return context;
}
/// <summary>
/// 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".
/// </summary>
/// <param name="options">The options object to set the path on.</param>
/// <param name="path">The path that should go after the umbraco path, will add a leading slash if it's missing.</param>
/// <returns></returns>
public RemoteAuthenticationOptions SetUmbracoBasedCallbackPath(RemoteAuthenticationOptions options, string path)
{
var umbracoCallbackPath = _securitySettings.Value.AuthorizeCallbackPathName;
options.CallbackPath = umbracoCallbackPath + path.EnsureStartsWith("/");
return options;
}
}