We'd like to support password protected pages in our CMS application. The scenario is that an administrator can set a password for a page and upon visiting the page URL, a site visitor would be prompted to enter the password in order to view the page.
The password storage / validation mechanism is not important here. What I'd like to know is the best way to handle multiple authentication cookies with the OWIN Cookie Auth middleware since we'd like the cookie to be persistent so a user does not have to re-enter the password if they refresh the page.
Options I considered:
- Setting the path of the auth cookie to the individual page that has been password protected - this way it won't interfere with other password protected pages
- Making the cookie name unique to the page being accessed
The issue I can see with the above approaches is that I'm not sure the above options can be configured dynamically at runtime.
Perhaps using the cookie middleware is overkill for this so I'm open to other solutions.