Created
March 28, 2014 15:33
-
-
Save HenrikFrystykNielsen/9835526 to your computer and use it in GitHub Desktop.
Gist of how to hook in additional OWIN authentication providers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Web.Http; | |
using Autofac; | |
using Microsoft.WindowsAzure.Mobile.Service; | |
using Microsoft.WindowsAzure.Mobile.Service.Config; | |
using Owin; | |
namespace henrikntest09Service | |
{ | |
public static class WebApiConfig | |
{ | |
public static void Register() | |
{ | |
// Use this class to set configuration options for your mobile service | |
ConfigOptions options = new ConfigOptions(); | |
// Use this class to set WebAPI configuration options | |
HttpConfiguration config = ServiceConfig.Initialize(new ConfigBuilder(options, (httpConfig, autofac) => | |
{ | |
autofac.RegisterInstance(new AuthOwinAppBuilder(httpConfig)).As<IOwinAppBuilder>(); | |
})); | |
} | |
} | |
public class AuthOwinAppBuilder : OwinAppBuilder | |
{ | |
public AuthOwinAppBuilder(HttpConfiguration config) | |
: base(config) | |
{ | |
} | |
protected override void ConfigureAuthentication(IAppBuilder appBuilder, HttpConfiguration config) | |
{ | |
base.ConfigureAuthentication(appBuilder, config); | |
// Add your own authentication modules | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment