owin

Mixed mode authentication with OWIN

最后都变了- 提交于 2019-12-21 05:04:02
问题 I am building an MVC 5 application. I need to authenticate people against an AD and a sql data base or a web service. Requirement is if a person is logged into corporate network or conneted over VPN i have to log them without asking for credentials. if the users are accessing the web site over internet or a person do not have AD account i have to use forms authentication. I am looking at this article but will this work with ASP.Net MVC and OWIN? Any other alternative? Thanks in advance. 回答1:

Identity Server and web api for user management

十年热恋 提交于 2019-12-21 04:51:32
问题 I'm using Identity Server3 for my project, I currently have a website and api being protected by the Id server, this is working fine however because I'm storing the users in the Id Server database I can't really change any user's data from the website like changing the profile picture or any claim value. In order to solve this I'm thinking in creating an API on top of IdServer, this API will manage the users, changing a password, retrieving users or changing anything related to a user

What does exactly is the Microsoft.Owin.Cors middleware when used with ASP.NET Web Api 2.0?

大憨熊 提交于 2019-12-21 04:39:24
问题 I have an ASP.NET Web Api 2.0 project with token authentication and everything done mainly following this article: Token Based Authentication using ASP.NET Web API 2, Owin, and Identity, Bit Of Technology But I am struggling to understand what exactly this line of code in my Startup.cs does: app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); This does not make the Web Api add the Access-Control-Allow-Origin header to my API responses, in other words it does not enable Cors in my Web Api

How to hold the cookies claims updated with MCV5/OWIN

一个人想着一个人 提交于 2019-12-21 04:25:15
问题 We’re working on an OWIN MVC5 project. We use an own implementation of IUserStore<T> to integrate the user-management which is part of our companies framework. So far this works fine. We want to provide role membership and other security configuration through claims. I have seen (and quickly tested) the ways of either implementing IUserClaimStore<T> or of attaching a ClaimsIdentityFactory to the UserManager. In both scenarios, I see the issue that the claims are stored in the user’s cookie

FormsAuthentication object obsolete [using MVC5]

牧云@^-^@ 提交于 2019-12-21 03:43:20
问题 I'm using the following code in an MVC5 site: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Login(LoginModel loginModel) { if (ModelState.IsValid) { var authenticated = FormsAuthentication.Authenticate(loginModel.UserName, loginModel.Password); if (authenticated) { FormsAuthentication.SetAuthCookie(loginModel.UserName, true); return RedirectToAction("AdminPanel"); } ModelState.AddModelError("", "The username and password combination were incorrect"); } return View(loginModel); }

How can an OWIN Startup method get the base URL of the web site?

江枫思渺然 提交于 2019-12-21 03:35:25
问题 How can an OWIN startup method get the base URL of the web site? I'm trying to write code that will work when debugging with IISExpress, unit testing with self hosting and under IIS. When self hosting, I can find this information in IAppBuilder.Properties["host.Addresses"] but, it isn't there when running under IISExpress (haven't checked IIS). 回答1: System.Web.VirtualPathUtility.ToAbsolute("~") 回答2: Please don't downvote this anymore post. This is not an accepted answer. I am keeping this

System.Net.HttpListenerException: Failed to listen on prefix 'http://localhost:8080

[亡魂溺海] 提交于 2019-12-21 03:33:05
问题 I am running the following code from Scott Allen's ASP.Net Fundamentals course using System; using Microsoft.Owin.Hosting; using Owin; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string uri = "http://localhost:8080"; using (WebApp.Start<Startup>(uri)) { Console.WriteLine("Started!"); Console.ReadKey(); Console.WriteLine("Stopping!"); } } } public class Startup { public void Configuration(IAppBuilder app) { app.UseWelcomePage(); //app.Run( // ctx => ctx

Using an existing IoC Container in SignalR 2.0

眉间皱痕 提交于 2019-12-21 02:22:12
问题 How can I use an existing IoC with SignalR 2.0? From the tutorial, it seems I need to setup a class to be called from OWIN via an attribute: using Microsoft.Owin; using Owin; [assembly: OwinStartup(typeof(SignalRChat.Startup))] namespace SignalRChat { public class Startup { public void Configuration(IAppBuilder app /*HOW AM I GONNA GET UNITY CONTAINER HERE?*/) { var hubConfig = new HubConfiguration() { EnableJSONP = true, EnableDetailedErrors = true, EnableJavaScriptProxies = true, Resolver =

How to implement global.asax events by OWIN

久未见 提交于 2019-12-21 01:59:33
问题 from asp.net 6 there would be no file called global.asax but global.asax has many events like · Application_Init · Application_Start · Session_Start · Application_BeginRequest · Application_EndRequest · Application_AuthenticateRequest · Application_Error · Session_End · Application_End say for example i often work with Application_BeginRequest event to redirect user. here is a sample code protected void Application_BeginRequest(Object sender, EventArgs e) { if (HttpContext.Current.Request.Url

OWIN token authentication 400 Bad Request on OPTIONS from browser

爷,独闯天下 提交于 2019-12-20 18:42:37
问题 I am using token authentication for small project based on this article: http://bitoftech.net/2014/06/09/angularjs-token-authentication-using-asp-net-web-api-2-owin-asp-net-identity/ Everything seems to work fine except one thing: OWIN based token authentication doesn't allow OPTIONS request on /token endpoint. Web API returns 400 Bad Request and whole browser app stops sending POST request to obtain token. I have all CORS enabled in application as in sample project. Below some code that