Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Thinktecture.IdentityModel configuration - basic + session token auth
public static class WebApiConfig
public static void Register(HttpConfiguration config)
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
var authConfig = new AuthenticationConfiguration
RequireSsl = false,
EnableSessionToken = true,
InheritHostClientIdentity = true,
ClaimsAuthenticationManager = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.ClaimsAuthenticationManager
// setup authentication against membership
config.MessageHandlers.Add(new AuthenticationHandler(authConfig));
public static bool Verify(string user, string pass)
var accountService = ServiceLocator.Current
var authSvc = ServiceLocator.Current
BrockAllen.MembershipReboot.UserAccount account;
var isAuthenticated = accountService.AuthenticateWithUsernameOrEmail(user, pass, out account);
return isAuthenticated;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment