I am starting a new series on the new Asp.Net Identity there are plenty of resources for MVC etc. but little for Web Forms so i thought I’d do a little investigation and document it here.
I am using Visual Studio 2013 Ultimate, remember Visual Studio 2013 Community is the new free edition of Visual Studio 2013 it is equivalent to Pro but has been stripped down to make it a smaller download, but I believe most of the bits that have been removed to create the community edition can be added back in, see Connect(); Microsoft Visual Studio vNext & Azure on Channel9.
Overview of the new Project Templates
Requirements .Net 4.5 and above, if you select .Net 4 as your framework type from the new Project dialog you will not see the One ASP.Net dialog and you will get the classic Membership added and this is not what you want as we are talking about the new Identity system.
Add new project template here for comparison.
Figure 1 – .Net 4 Web Application Project
Now we need to select the project template with a .Net framework of 4.5 as a minimum.
Figure 2 – Selecting the project template
Figure 3 – The One Asp.Net dialog
You will get the One Asp.net dialog from this you can change the the authentication type.
Figure 4 – Change Authentication dialog
Let’s examine the four options offered here:
This is simple enough no authentication will be added to the project, it’s worth noting that this is not the default so you will need to select this option of you want a project without authentication.
Figure 5 – Option 1
Individual User Accounts
This option is equivalent to the old Membership system default,
Figure 6 – Option 2
This is an area of big improvement over the old Membership system allowing us greater flexibility, all these options are using some form of Active Directory Federation Services Overview i.e. ADFS, Azure Active Directory. but none connect directly with Active Directory if I understand this correctly, this is probably a good thing as the issue with AD is that it’s slow so if you are looking for Roles membership in AD you would need to cache as the delays can become very long.
Figure 7 – Option 3
Figure 8 – More Options
- Choose this option to connect to your Microsoft Azure Active Directory tenet.
- Enter the domain name of you Microsoft Azure Active Directory tenet.
- Indicate what access the application will have to the directory. For an application that queries the directory using the Directory Graph API, choose an option that enables reading or writing.
- Enter a unique URI to identify this application. (If you leave it blank, a URI will be created automatically by appending the project name to the Microsoft Azure Active Directory domain with a number if needed to make it unique.)
Figure 9 – On-Premises option for Active Directory
- Choose On-Premises if the organization manages user accounts by using Windows Server Active Directory or ADFS and you don’t want to use Microsoft Azure Active Directory.
- The metadata document contains the coordinates of the authority. Your application will use those coordinates to drive the web sign on flow.
- Provide a unique URI that Windows Server Active Directory can use to identify this app.
This is the same as the original Windows Authentication, in fact if you look at Figure 11 you can see the changes to the web.config are the same as the always have been for “Windows Authentication”.
Figure 10 – Option 4
Figure 11 – web.config authentication changes
So that’s the introduction done next we will be adding Identity to a existing WebForms application.