Integrate Lightswitch HTML deployed as Web Site with Windows Azure Active Directory

758 views Asked by At

I'm trying to implement Windows Authentication in a newly created Lightswitch HTML application hosted in Windows Azure as a Web Site. After creating the Active Directory and the application and following the steps provided in the blog entry refered in the portal, I have managed to get the login page and perform the validation. But, once I'm back at the HTML website, I get a 500 error for every request.

In order to test the validation, I've created a generic handler which simply returns the username:

public void ProcessRequest(HttpContext context)
{
    using (var serverContext = ServerApplicationContext.CreateContext())
    {
        context.Response.ContentType = "text/plain";
        context.Response.Write(serverContext.Application.User.Name);
    }
}

and disabled customErrors and managed to get error details:

[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.LightSwitch.Utilities.Server.Internal.ServerRequestSecurityState.GetSecurityGroupsForCurrentUser(IWindowsIdentity identity) +20
   Microsoft.LightSwitch.Utilities.Server.Internal.ServerRequestSecurityState.GetEffectiveRolesForUser(IIdentity identity, IEnumerable`1 currentRoles, Func`3 getRoles) +687
   Microsoft.LightSwitch.Utilities.Server.Internal.ServerRequestSecurityState.GetEffectiveRolesForUser(IIdentity identity, IEnumerable`1 currentRoles) +121
   Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.GetUserData(IPrincipal principal) +305
   Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.CreateUser(IPrincipal principal) +18
   Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityInfo.CreateUser(IPrincipal principal) +7
   Microsoft.LightSwitch.Utilities.Server.Internal.SecurityHelper.ConvertPrincipal(IPrincipal principal) +184
   Microsoft.LightSwitch.Framework.Server.ServerApplication`2.get_User() +166
   LightSwitchApplication.Web.GetUserName.ProcessRequest(HttpContext context) +144
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

I don't know if there is something I'm missing or that maybe, this scenario (Lightswitch in Azure Web Site + Azure AD) is not supported by Lightswtich at this moment

0

There are 0 answers