owin

What is the difference in the use of UserStore and UserManager in Asp.Net Identtity?

≯℡__Kan透↙ 提交于 2019-12-18 10:34:00
问题 I'm very new to Asp.Net Identity and please bear with me if this question seems silly. So, when I read the definition for UserStore class and UserManager class in Microsoft website which are in the links below, it looks like both class define operations around users (like Add, Find, Delete and Modify). So when do I use one over the other?: https://msdn.microsoft.com/en-us/library/dn315446(v=vs.108).aspx https://msdn.microsoft.com/en-us/library/dn613290(v=vs.108).aspx 回答1: Things are quite

Relationship between Webapi, Webhost and Owin

我与影子孤独终老i 提交于 2019-12-18 10:30:07
问题 I'm just trying to get my head around relationship between webapi, webhost (iis) and owin. I'll write down my current understanding, and I ask you to tell me if it is correct or not. Webapi , unlike MVC was written in host-independent manner. This was in pre-Owin days, but apparently they anticipated that Owin would happen sooner or later. Host independency mainly means that System.Web is not used anywhere in Webapi code. It is System.Web that relies solely on IIS and would not work without

MVC Bootstrap Themes

放肆的年华 提交于 2019-12-18 09:36:21
问题 I want to include theme support for the bootswatch themes in my MVC 5 app. I want the users theme to be saved and loaded when they log in. I have extended my user class to include the theme and can successfully set and save a theme on the edit user page. public class User : IdentityUser { public string BootstrapTheme {get;set;} } In the BootstrapTheme property I'll save the href attribute for the bootstrap css link. eg "~/Content/bootstrap.flatly.min.css" The plan is to set the theme in the

No owin.Environment item was found in the context - only on server

耗尽温柔 提交于 2019-12-18 09:07:22
问题 I'm getting this error: No owin.Environment item was found in the context I've seen a zillion posts telling me that I need <appSettings> <add key="owin:AppStartup" value="[AssemblyName].Startup, [AssemblyName]" /> </appSettings> but that does nothing for me. I am running Identity 2.0 and all upgraded OWIN components. Also, this runs fine locally, but when pushed to my VM, I get this error? Seems like either a setting is off or something else needs to be installed. WebPI says I have .NET 4.5.1

Variable cookie path with ASP.NET Identity

怎甘沉沦 提交于 2019-12-18 06:00:38
问题 We migrated a multitenant MVC application from ASP.NET Membership Provider to ASP.NET Identity. This is my Startup.Auth.cs (simplified): public partial class Startup { public void ConfigureAuth(IAppBuilder app) { app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes

Variable cookie path with ASP.NET Identity

你。 提交于 2019-12-18 06:00:12
问题 We migrated a multitenant MVC application from ASP.NET Membership Provider to ASP.NET Identity. This is my Startup.Auth.cs (simplified): public partial class Startup { public void ConfigureAuth(IAppBuilder app) { app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create); app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create); app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes

How to intercept 404 using Owin middleware

十年热恋 提交于 2019-12-18 05:44:32
问题 Background First let me explain the background. I am working on a project that attempts to marry a backend server that uses Web API configured via OWIN- hosted on IIS now, but potentially other OWIN-supported hosts in the future- to a frontend using AngularJS. The AngularJS frontend is entirely static content. I completely avoid server-side technologies such as MVC/Razor, WebForms, Bundles, anything that has to do with the frontend and the assets it uses, and defer instead to the latest and

Autofac dependency injection in implementation of OAuthAuthorizationServerProvider

≯℡__Kan透↙ 提交于 2019-12-18 03:10:14
问题 I am creating a Web Api application and I want to use bearer tokens for the user authentication. I implemented the token logic, following this post and everything seems to work fine. NOTE: I am not using the ASP.NET Identity Provider. Instead I have created a custom User entity and services for it. public class Startup { public void Configuration(IAppBuilder app) { ConfigureOAuth(app); var config = new HttpConfiguration(); var container = DependancyConfig.Register(); var dependencyResolver =

Can OWIN middleware use the http session?

空扰寡人 提交于 2019-12-18 02:00:51
问题 I had a little bit of code that I was duplicating for ASP.NET and SignalR and I decided to rewrite it as OWIN middleware to remove this duplication. Once I was running it I noticed that HttpContext.Current.Session was null, and I didn't see any session object on the IOwinContext that my middleware has. Is it possible to access the http session from OWIN? 回答1: Yes, but it's quite a hack. It also won't work with SignalR because SignalR MUST run before session is acquired to prevent long session

Token based implementation in webapi to secure endpoints

你。 提交于 2019-12-17 22:28:13
问题 I am having a web application with web service and client will register their application using my web application. Now client will have application of type SPA or mobile apps and they will consume my webservices from their apps. So I would be implementing token based mechanism for securing access to my endpoints. 1) But here I am confused that shall I use any framework to generate access token or I can use any library which will generate any random string which i will send in response.for