Easily lock out Umbraco back office users
![Easily lock out Umbraco back office users](/media/0zpblxsk/https-localhost-44366-pnzirfsg-http-localhost-44441-media-1023-jose-fontano-246362.jpg?width=1024&height=512&v=1da0e913a1ff2b0&)
Want an easy way to lock out all back office users?
Maybe you are performing an upgrade and want to make sure there’s no back office activity?
Here’s a handy script to do this
using System;
using Microsoft.Owin;
using Owin;
using Umbraco.Web;
[assembly: OwinStartup("AuthDisabledOwinStartup", typeof(MyWebsite.AuthDisabledOwinStartup))]
namespace MyWebsite
{
public class AuthDisabledOwinStartup : UmbracoDefaultOwinStartup
{
protected override void ConfigureUmbracoAuthentication(IAppBuilder app)
{
//Don't do anything, this will mean all cookie authentication is disabled which means
//that no requests from the back office user will be authenticated and therefore
//all requests will fail and the user will be logged out.
}
}
}
Now you can just update your web.config appSetting to
<add value="AuthDisabledOwinStartup" key="owin:appStartup"></add>
When you want to allow back office access again, just update your web.config with your original owin:appStartup value
comments powered by Disqus