Cut Requirement Bloat and Speed Up Feature Delivery
Overcomplicated requirements are slowing you down. Here’s how trimming the excess can help you launc
Optimizely Most Valued Professional (OMVP), Subject Matter Expert (SME), CMS and Commerce certified
Contact MeThis solution is for having multiple or dynamic login paths for the same authentication provider. Out of the box ASP.NET Core, you define a login path when configuring the authentication provider in startup.cs. But you can only define one path for a single authentication provider.
An example would be If you want to keep the default Optimizely login url for admins but also have a separate custom style page login for users.
(In Optimizely, the login path is '<site>/util/login')
ASP.NET Core offers the IAuthorizationMiddlewareResultHandler which allows you to customize the handling of authentication or authorization response.
In our example we want to customize the authentication response when the user has been challenged. In other words, they have requested to access a resource they are currently not authorized against and ASP.NET Core is redirecting them to the default behaviour. In our case is the login path.
We want to enhance this by working out which resource they were trying to access and send them to the relevant login path.
public class LoginRedirectAuthorizationMiddlewareResultHandler : IAuthorizationMiddlewareResultHandler
{
private readonly AuthorizationMiddlewareResultHandler defaultHandler = new();
private readonly IUrlResolver urlResolver;
private readonly IContentLoader _contentLoader;
public LoginRedirectAuthorizationMiddlewareResultHandler(IUrlResolver urlResolver, IContentLoader contentLoader)
{
this.urlResolver = urlResolver;
_contentLoader = contentLoader;
}
public async Task HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
{
var isEpiserverAdminUrl = context.Request.Path.StartsWithSegments(new PathString("/episerver"));
if (authorizeResult.Challenged && !isEpiserverAdminUrl)
{
var loginPage = GetLoginPage();
var url = urlResolver.GetUrl(loginPage?.ContentLink); context.Response.Redirect(url);
return;
}
await defaultHandler.HandleAsync(next, context, policy, authorizeResult);
}
}
Overcomplicated requirements are slowing you down. Here’s how trimming the excess can help you launc
I discuss our experiences not validating business features early which result in delayed projects
Best practice of managing your Optimizely nuget packages
Demystify Image Resizing on the edge for your Optimizely solution
Critical parts of an upgrade can help you understand the different stages of an upgrade. Let's discu
Optimizely Customers now have a choice between using CMS on either PaaS or SaaS
SaaS Core is Optimizely's latest CMS offering as part of its composable architecture
We describe Optimizely's newest Content as a Service offering Optimizely Graph and how you should be
Straightforward RSS feed generation for your Optimizely solution with this NuGet package
Headless vs Traditional doesn't have to be a hard choice. An Optionality approach gives you the best
We are proud to announce Optimizely has awarded Hidden Foundry with Specializations
We discuss our experiences of working with Navico to refactor their single site into a multi-site so
We summerize our experience of working with FirstMile and helping them move over to Optimizely Comme
Grasp ODP and how it's AI and data consolidation enables insight driven conversions
We outline the benefits of upgrading your Optimizely solution to ASP.NET Core
Expand content area properties to load nested contact areas recursively to a customizable level
Learn to use CLI and dotnet command to create new cms / commerce projects and perform admin actions.
How to use friendly segments instead of query strings as parameters in your action method
Guide to implementing Srcset against img tags in an Optimizely solution