ASP.NET MVC 4 AllowAnonymous Attribute and Authorize Attribute
Orchard Authentication Module - Secure Pages
Developing Orchard Websites is fun, especially when the Orchard Website requires a custom Orchard Module to extend the functionality of Orchard that isn't provided out-of-the-box or in the Orchard Gallery. In addition to developing Orchard Websites and custom Orchard Themes, I develop a lot of Orchard Modules for clients. From time-to-time I like to mention custom Orchard Modules I develop, and this time I thought I would mention a module I created to help secure Orchard Pages from anonymous users. It's an Orchard Authorization Module that allows the Orchard Website Administrator to secure selected front-end pages from public / anonymous users.
Orchard Authorization
Orchard CMS uses roles-based authentication on your Orchard Website and the most you can do out-of-the-box to secure front-end pages in Orchard is to disable anonymous users and/or specify certain user roles. Unfortunately, you don't get to disable anonymous access on a page-by-page basis. This can be frustrating when you only have a few pages that require the Orchard User to be authenticated on the website. This is the situation with a recent client of mine and why I created a simple Orchard Authorization Module that allowed them to choose whether a page could be accessed by anonymous users.
Securing Orchard CMS Pages
This was a fun custom Orchard Module to create and securing pages in Orchard CMS front anonymous users is as simple as checking a checkbox when you add or edit a page. In this case I am securing the About Us Page for an Orchard Website for kicks.

Once you have chosen to only allow Authenticated Users to access the Orchard Page, you will see that it is secured from the Orchard Administrator Summary View.

The end result is that now when an anonymous user tries to view the About Us Page on the Orchard Website they will be redirected to log into the website in order to view it. Of course, unchecking the check box ( the default ) allows all anonymous users to view the page as normal.
Conclusion
Developing custom Orchard Modules is extremely fun. As you can see, some pretty useful features can be created by simply extending your Orchard Websites with custom modules.


