Skip to content

Commit

Permalink
Merge pull request #72 from brettsam/MobileApp
Browse files Browse the repository at this point in the history
updating .NET backend quickstart for version 0.3.36
  • Loading branch information
brettsam committed Nov 16, 2015
2 parents acc1175 + 2f83416 commit 1533ad3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.Entity;
using System.Web.Http;
using Microsoft.Azure.Mobile.Server;
using Microsoft.Azure.Mobile.Server.Authentication;
using Microsoft.Azure.Mobile.Server.Config;
using ZUMOAPPNAMEService.DataObjects;
using ZUMOAPPNAMEService.Models;
Expand All @@ -28,8 +31,20 @@ public static void ConfigureMobileApp(IAppBuilder app)
// To prevent Entity Framework from modifying your database schema, use a null database initializer
// Database.SetInitializer<ZUMOAPPNAMEContext>(null);

// Uncomment the line below to use App Service Authentication during development
// app.UseAppServiceAuthentication(config, AppServiceAuthenticationMode.LocalOnly);
MobileAppSettingsDictionary settings = config.GetMobileAppSettingsProvider().GetMobileAppSettings();

if (string.IsNullOrEmpty(settings.HostName))
{
// This middleware is intended to be used locally for debugging. By default, HostName will
// only have a value when running in an App Service application.
app.UseAppServiceAuthentication(new AppServiceAuthenticationOptions
{
SigningKey = ConfigurationManager.AppSettings["SigningKey"],
ValidAudiences = new[] { ConfigurationManager.AppSettings["ValidAudience"] },
ValidIssuers = new[] { ConfigurationManager.AppSettings["ValidIssuer"] },
TokenHandler = config.GetMobileAppTokenHandler()
});
}
app.UseWebApi(config);
}
}
Expand Down
9 changes: 3 additions & 6 deletions backend/dotnet/Quickstart/ZUMOAPPNAMEService/Web.tt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@
<add name="MS_NotificationHubConnectionString" connectionString="Endpoint=sb://[your namespace].servicebus.windows.net;SharedSecretIssuer=owner;SharedSecretValue=[your secret]"/>
</connectionStrings>
<appSettings>

<add key="PreserveLoginUrl" value="true" />

<!-- Use these settings for local development. After publishing to your
Mobile App, these settings will be overridden by the values specified
in the portal. -->
<add key="MS_MobileServiceName" value="ZUMOAPPNAME" />
<add key="MS_SigningKey" value="Overridden by portal settings" />
<add key="EMA_RuntimeUrl" value="ZUMOGATEWAYURL" />
<add key="SigningKey" value="Use App Service Authentication Signing Key here to validate tokens" />
<add key="ValidAudience" value="https://{yoursite}.azurewebsites.net/" />
<add key="ValidIssuer" value="https://{yoursite}.azurewebsites.net/" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<HintPath><#= this.GetHintPath(nugetPackages, "Microsoft.Azure.NotificationHubs", "net45-full")#>\Microsoft.Azure.NotificationHubs.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Net.Http" />
Expand Down

0 comments on commit 1533ad3

Please sign in to comment.