locked
How to create login/password screen with LightSwitch? RRS feed

  • Question

  • How would you go about creating login/password and new user/registration functionality with LightSwitch?  I can imagine a hack where I create an entity with the username and password but I do not know whether this is secure.  I'm guessing that the password would not be encrypted when it is sent over the wire.

     

    How would you do this?

    Tuesday, September 28, 2010 11:48 AM

Answers

All replies

  • It sounds like you want to create custom versions of the sign-in page and the Users administration screen, is that correct?

    To create a custom version of the sign-in page, you could create a custom login.aspx page that handles authenticating the user.  Once the user is authenticated it can then redirect to the LightSwitch app's XAP file.  Currently, there's a bug in Beta 1 that prevents the LightSwitch app from recognizing that the user was authenticated outside of the app.  This has since been fixed though so expect to see a blog post describing how to do this once the next public release is available.

    Creating your own screen to administer the UserRegistration and other security entities is a little tricky.  These entities are currently not referenceable from your application model.  So you can't design a screen that references those entities.  Instead, you can follow the technique I describe in my blog post here: http://blogs.msdn.com/b/mthalman/archive/2010/09/20/how-to-reference-security-entities-in-lightswitch.aspx.  This allows you to create proxy entities to work around this.

    As far as securing the password, this would be necessary anyway regardless of whether you created your own custom screens.  This would be done by configuring the IIS website to use SSL.

    Tuesday, September 28, 2010 12:39 PM
  • It sounds like you want to create custom versions of the sign-in page and the Users administration screen, is that correct?

     

    Actually, I would be very happy if I could just use the existing sign-in page and users administration screen.  I didn't know that they existed.

    Is there a tutorial or documentation that describes them?

    Tuesday, September 28, 2010 1:12 PM
  • Ah, in that case you can read this tutorial on how to create a role-based LightSwitch application: http://msdn.microsoft.com/en-us/library/ff851957.aspx.
    Tuesday, September 28, 2010 1:17 PM