owin

OWIN and ASP.net membership in IIS 8.5 not working

[亡魂溺海] 提交于 2019-12-23 02:34:57
问题 I created an ASP.NET MVC project in visual studio 2015. I used the Windows Identity Foundation based template for individual accounts available in visual studio. Then I configure it for facebook and Google. It works perfectly when i run it from Visual Studio or IIS 7.5. I Could redirect to Google or Facebook page and I was able to register using email and I could see the records saved in the database. However, when i deploy the app on IIS 8.5 running on windows server 2012 R2, on clicking the

Is it possible to use Furl.Http with the OWIN TestServer?

此生再无相见时 提交于 2019-12-23 02:31:22
问题 I'm using the OWIN TestServer which provides me an HttpClient to do my in memory calls to the test server. I'm wondering if there's a way of passing in the existing HttpClient for Flurl to use. 回答1: UPDATE: Much of the information below is no longer relevant in Flurl.Http 2.x. Specifically, most of Flurl's functionality is contained in the new FlurlClient object (which wraps HttpClient ) and not in a custom message handler, so you're not losing functionality if you provide a different

OWIN cookie authentication get roles on client side

我是研究僧i 提交于 2019-12-23 00:51:30
问题 I'm developing an application where backend is asp.net owin based. In Startup.cs I have IAppBuilder.useCookieAuthentication() { ... }. After successfully authenticated, current user with its roles can be accessed via HttpContext in all my web api controllers. My javascript client side needs a knowledge about these roles in order to know how to display specific items. For example: user having administrator role can see additional tabs. My question is: what's the best way to 'transfer' these

UseWsFederationAuthentication - AuthenticationException: The remote certificate is invalid according to the validation procedure

元气小坏坏 提交于 2019-12-22 17:22:33
问题 I am getting an error every time I try to run my MVC project on my development box through VS2015 and IIS Express. It uses this code to authenticate against our ADFS server. app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseWsFederationAuthentication( new WsFederationAuthenticationOptions { Wtrealm = realm, MetadataAddress = adfsMetadata }); This is the error I am getting in the

UseWsFederationAuthentication - AuthenticationException: The remote certificate is invalid according to the validation procedure

送分小仙女□ 提交于 2019-12-22 17:21:55
问题 I am getting an error every time I try to run my MVC project on my development box through VS2015 and IIS Express. It uses this code to authenticate against our ADFS server. app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseWsFederationAuthentication( new WsFederationAuthenticationOptions { Wtrealm = realm, MetadataAddress = adfsMetadata }); This is the error I am getting in the

Why is owin middleware created a second time after the HttpRequest ended

痴心易碎 提交于 2019-12-22 12:32:40
问题 After a question as per why the ApplicationDbContext from Asp.Net Identity is created and disposed twice per Request I did some research why this would happen. I found that the ApplicationDbContext is actualy created once per HttpRequest but when using the Owin pipeline the Owin Middleware will be created a second time after the HttpRequest has ended. Because of this the ApplicationDbContext is indeed created for a second time when a user clicks one link giving the impression that the object

Identity disappears from bearer token after an hour

妖精的绣舞 提交于 2019-12-22 10:55:26
问题 I am working on a multi-tenant solution with Azure AD with web apps and a web api. The web app uses OpenIdConnect to retrieve a bearer token (which is cached in Azure Redis Cache), which is used in Angular to get JSON from the web api. User impersonation is used between the web app and web api (set up in Azure AD applications). Problem: This works fine for about an hour, then the Identity suddenly disappears on the web api side. If I refresh the web app, I see that the page is redirected to

How do I enable the TypeScript tab of a Visual Studio project that's a console or windows service that's self-hosting web-pages

烈酒焚心 提交于 2019-12-22 10:34:41
问题 Using Visual Studio 2015 I created a console application to self-host Owin with embedded static files. Since Visual Studio doesn't know it's a web-site project, it ignores TypeScript files. When I go to the project properties, the TypeScript tab's typically there in web projects is missing. How do I enabled the TypeScript tab so that I can configure TypeScript and use Visual Studio 2015's built-in capabilities to compile TypeScript. 回答1: Open the .csproj file in a text editor and add the

How do you reject a Katana Bearer token's identity

雨燕双飞 提交于 2019-12-22 09:07:51
问题 How can I reject An identity? My class inherits from OAuthBearerAuthenticationProvider and I have an override of ValidateIdentity? I have tried setting context.Rejected(); or context.SetError(); and throwing an exception but my controllers still get called. OAuthBearerAuthenticationHandler does call my class so I know I have the setup correct. my current failing code public void ConfigureAuth ( IAppBuilder app ) { // Enable the application to use a cookie to store information for the signed

Simple Injector and default AccountContoller dependency issue

点点圈 提交于 2019-12-22 08:49:58
问题 I have problem with Simple Injector in my Web Api project. I user default AccountController generated by VS. public AccountController(ApplicationUserManager userManager, ISecureDataFormat<AuthenticationTicket> accessTokenFormat) In my configuration file I register: var container = new Container(); // This is an extension method from the integration package. container.RegisterWebApiFilterProvider(config); container.RegisterWebApiControllers(config); container.Register<IInitializeService,