protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines) { base.ApplicationStartup(container, pipelines); //var configuration = new StatelessAuthenticationConfiguration(context => //{ // var token = context.AuthorizationHeaderToken(); // var authenticator = container.Resolve<IAuthenticateUser>(); // return string.IsNullOrWhiteSpace(token) ? null : authenticator != null ? authenticator.GetUserIdentity(token) : null; //}); //StatelessAuthentication.Enable(pipelines, configuration); pipelines.EnableStatelessAuthentication(container.Resolve<IAuthenticateUser>()); pipelines.EnableCors(); // cross origin resource sharing pipelines.EnableMonitoring(); //Make every request SSL based //pipelines.BeforeRequest += ctx => //{ // return (!ctx.Request.Url.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase)) ? // (Response)HttpStatusCode.Unauthorized : // null; //}; }