BrowserID is a decentralized identity system which verifies the ownership of an email address in a secure manner, without the use of any application specific authentication mechanism. Which means, you don’t need to provide an login forms in your application, instead use BrowserID feature.
I am not going to explain in detail about this, but you can follow the links below to know more about it
I have created demo application to show how it could be integrated into ASP.NET MVC (it could applied to ASP.NET Forms also) application.
###How the Demo Application works
In this demo, Secret page link can only accessed if you have logged into the application. In order to login I have provided a Sign in button, like most of the applications, but when you click on it. It will open a pop-up window (make sure you have disable pop-up blockers), which is a URL from https://browserid.org not from my application. If you don’t have a BrowserID create one, otherwise enter the Email address and Password. Then follow the steps and finally click on the Sign in button, which log you into the application and from there you can access the Secret page link.
###How to implement this in ASP.NET MVC
*Enable BrowserID in your application : *
Include the BrowserID javascript file https://browserid.org/include.js to your master page<script src="@Url.Content("https://browserid.org/include.js")" type="text/javascript"></script>
*Identify the User : *
Instead of displaying a login form on your site which takes a username and password, it uses the BrowserID JavaScript API when the user clicks your sign-in button. For that I have added the below script to the _LogOnPartial.cshtml which comes with the ASP.NET MVC application you have created
1 | $(document).ready(function () { |
Upon a successful sign-in, you’ll be called back with an assertion, a string containing a signed claim that proves the user is who they say they are. Which is passed to a method called gotVerifiedEmail
1 | // a handler that is passed an assertion after the user logs in via the |
Which then sends a POST Request to the LogOn
method on the Account controller, for verifying the assertion is correct or not. If it is a verified correctly, we will set up a forms authentication cookie so that ASP.NET feels that user has logged in to the application. Then returns the Email address back.
1 | [ ] |
In order to do the verification, we post the assertion to the URL provided by the Identity Authority itself (https://browserid.org/verify in this case), which will give a valid response if it is valid. The Verify method looks like this
1 | public VerificationResult Verify(string assertion) |
Hope this will help you to setup an authentication system to your application very easily and in a more secure way.