Authentication in LightSwitch Beta 2 Part II: Windows Authentication



Prologue:

In Part I of this Article, we have seen creation of an application with Forms Authentication i.e. when an application starts it should ask the user to enter login credentials.

In this let us discuss about how to create Windows Authentication Application.

Preparing Solution:

We have already created the project FormsAuthenticatioInLS; use that project to continue the creation of Users, Roles and Permission.

Let's confirm the Table has the following columns.

LightSwitch1.gif

Setting Windows Authentication:

If the Table is perfect then next check with the Project Properties to confirm that you have selected Use Windows Authentication option.

Windows Authentication is recommended if all your users are on a windows domain and you want to trust that whoever is logged into their computer is the same user that is using the application.

It means you don't have to provide an additional login form. This is handy because you never have to store or manage passwords outside of Windows itself which makes it very secure, however this is usually only practical if the application is running in a corporate/domain Intranet environment.

LightSwitch2.gif

In Project Properties Windows select Access Control and then select the option Use Windows Authentication.

You have two options with Windows Authentication.

  1. Allow only users specified in the Users screen of your application.
  2. Allow any authenticated Windows user.

The first option will let you to create users in our application to authenticate.

The User name must be a valid username in the form of an alias (jagan), domain and alias (jagansvr\jagan), alias and domain ([email protected]), or fully qualified domain name and alias (sbalram.corp.jagansvr.com\jagan), and it must be less than 256 characters. If you are using Forms authentication, the username must be unique and must be less than 256 characters.

The second option will allow all users in a Windows domain or authenticated by Windows. Press F5 to see the Application in Action.

articleImg_10.png

As we have selected Windows Authentication our application is logged in automatically as a Windows Authenticated user.

LightSwitch4.gif

For you, the reader, keep in mind that we are doing all this in Debug mode only not with a Published/Deployed LightSwitch Application.

So what I am trying to say is we will discuss the Deployment of LightSwitch application in the next article.

Summary:

In this article (Part - I), we have seen the basics of Forms Authentication in LightSwitch Beta 2.

Thanks for spending your precious time here. Please provide your valuable feedbacks and comments, which enable me to give a better article the next time.

Please rate this Article.

Thanks.

Next Recommended Readings