Every time I try to search for authentication I just get a bunch of pages describing how to auth back office users. I want to use the CMS as an intranet, and thus need to enforce authentication before any user can access any page - a site wide authentication. Is this possible? If so, where can I find documentation on how to set it up?
In the default method just get and check the current user, if it's null redirect to the login page (remember to make the login page and any error pages etc exceptions on the user check or redirect loop will occur),
Something simple like:
var currentUser = Member.GetCurrentMember();
if (currentUser == null)
{
return RedirectToUmbracoPage(1090); // whatever your login page id is
}
If you want a quick hack you could just add the above to your master template(s).
How can I force authentication for all users?
Every time I try to search for authentication I just get a bunch of pages describing how to auth back office users. I want to use the CMS as an intranet, and thus need to enforce authentication before any user can access any page - a site wide authentication. Is this possible? If so, where can I find documentation on how to set it up?
Hi Peter,
I would do this using a Default Custom Controller. See https://our.umbraco.org/documentation/implementation/default-routing/Controller-Selection/
In the default method just get and check the current user, if it's null redirect to the login page (remember to make the login page and any error pages etc exceptions on the user check or redirect loop will occur),
Something simple like:
If you want a quick hack you could just add the above to your master template(s).
HTH
Steve
is working on a reply...