Skip to content

Instantly share code, notes, and snippets.

@khalidabuhakmeh
Created March 29, 2013 15:45
Show Gist options
  • Select an option

  • Save khalidabuhakmeh/5271654 to your computer and use it in GitHub Desktop.

Select an option

Save khalidabuhakmeh/5271654 to your computer and use it in GitHub Desktop.
using Funq;
using Raven.Client;
using ServiceStack.Authentication.RavenDb;
using ServiceStack.CacheAccess;
using ServiceStack.CacheAccess.Providers;
using ServiceStack.Configuration;
using ServiceStack.ServiceInterface;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.WebHost.Endpoints;
namespace EndToEnd
{
public static class AuthConfig
{
public static void Start(IAppHost appHost, Container container)
{
var appSettings = new AppSettings();
//Default route: /auth/{provider}
appHost.Plugins.Add(new AuthFeature(() => new AuthUserSession(),
new IAuthProvider[] {
new BasicAuthProvider(appSettings),
new CredentialsAuthProvider(appSettings)
}) { IncludeAssignRoleServices = false, HtmlRedirect = null });
appHost.Plugins.Add(new RegistrationFeature());
container.Register<ICacheClient>(new MemoryCacheClient());
container.Register<IUserAuthRepository>(c =>
{
var documentStore = c.Resolve<IDocumentStore>();
return new RavenUserAuthRepository(documentStore);
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment