Maarten Balliauw {blog}

ASP.NET MVC, Microsoft Azure, PHP, web development ...

NAVIGATION - SEARCH

ASP.Net MVC Membership Starter Kit alternative authentication

Last week, I blogged about the ASP.Net MVC Membership Starter Kit and some of its features. Since then, Troy Goode and I are developing at warp-speed to provide a complete (Forms)Authentication starter kit for the MVC framework. Scott Guthrie also noticed our efforts, which forced us to do an official release earlier than planned.

Now when I say warp-speed, here's what to think of: we added Visual Studio item templates, a nice setup program, a demo application, ... We started with FormsAuthentication, but we have evolved into some alternatives...

OpenID authentication

You can add a route to the OpenID login action, and have an out-of-the box OpenID login form:

OpenID login

Simply enter your OpenID URL, click login. The MVC Membership Starter Kit will handle the rest for you!

More on this lightweight OpenID consumer from Mads Kristensen.

Windows Live ID authentication

For this, you'll need an application key. If you have one, you can add a route to the Windows Live ID login action, and have an out-of-the box Windows Live ID login form:

WLL login

Simply click the "Sign in" link. You will then be authenticated via Windows Live ID Web Authentication and returned to your ASP.Net MVC application when the authentication succeeds. The MVC Membership Starter Kit will handle all background processing for you!

WLL login

WLL login

More on Windows Live ID Web Authentication at dev.live.com.

Associate user with membership database

Both the OpenID and Windows Live ID authentication require you to do one "manual" step: implement the link between the membership database and the authentication method. You can simply override a virtual method in your own controller implementation, like so:

[code:c#]

protected override MembershipUser AssociateOpenIDToMembershipUser( string identity, string name, string email )
{
    // TODO: implement this to use OpenID authentication
    return null;
}

protected override MembershipUser AssociateWindowsLiveIDToMembershipUser(string userId)
{
    // TODO: implement this to use Windows Live ID authentication
    return null;
}

[/code]

What you'll have to do is return the ASP.Net membership user associated with the OpenID / Windows Live ID account.

The Windows Live ID authentication is currently only available from source control on CodePlex.

(by the way: I think this is the first OpenID and Windows Live ID implementation ever using the ASP.Net MVC framework)

kick it on DotNetKicks.com

blog comments powered by Disqus