Manual FormsAuthenticationTicket creation … in a OWIN Cookie middleware context

Traditionally, the urlauthorization module ofAPS.NET induced the forms authn module to search for session cookies, the lack of which would redirect to ones login page. Having validated credentials, once would use the library to issue a forms auth ticket (that would persist in the cookie).

So how do we do that in a OWIN cookie middleware environment (assuming the owin pipeline is sanely configured)?

Here is my attempt:

using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using System;
using System.Security.Claims;
using System.Web;
using System.Web.UI;

namespace WebApplication2
    public partial class _SSOLOGON : Page
        protected void Page_Load(object sender, EventArgs e)

                new AuthenticationProperties { IsPersistent = true },
                new ClaimsIdentity(new[] {
                                            new Claim(ClaimsIdentity.DefaultNameClaimType, "peter")


About home_pw

Computer Programmer who often does network administration with focus on security servers. Sometimes plays at slot machine programming.
This entry was posted in coding theory. Bookmark the permalink.