owin-middleware

Creating Owin Auth Provider that Exchanges a Custom Token for a .Net Auth Cookie

笑着哭i 提交于 2019-12-05 02:34:34
问题 I am trying to create an SSO like solution between 2 .Net applications .Net app 1 has a custom token generator and endpoints to validate tokens that returns user information. .Net application 2 is protected using Owin and was a typical standalone app and a user would directly login using a password and username. I created (based on Passion for Coding Blog and Github) a custom Owin provider that would look for a token either in a Authorization header or as a query parameter from a link that a

No conversion available between HelloWorldComponent and System.Func`2[System.Collections.Generic.IDictionary`2 // Parameter name: signature

橙三吉。 提交于 2019-12-04 03:35:36
问题 I am working through Scott Allen's MVC 5 Fundamentals course on Pluralsight I get an error at "using (WebApp.Start(uri)) " in the code below. The error is An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.Owin.dll System.ArgumentException was unhandled HResult=-2147024809 Message=No conversion available between ConsoleApplication1.HelloWorldComponent and System.Func`2[System.Collections.Generic.IDictionary`2[System.String,System.Object],System.Threading.Tasks

Creating Owin Auth Provider that Exchanges a Custom Token for a .Net Auth Cookie

时光总嘲笑我的痴心妄想 提交于 2019-12-03 17:21:06
I am trying to create an SSO like solution between 2 .Net applications .Net app 1 has a custom token generator and endpoints to validate tokens that returns user information. .Net application 2 is protected using Owin and was a typical standalone app and a user would directly login using a password and username. I created (based on Passion for Coding Blog and Github ) a custom Owin provider that would look for a token either in a Authorization header or as a query parameter from a link that a user would click a link from .Net App 1 and send to the .Net App 2 the token in the query string as at

ASP.NET Core middleware or OWIN middleware?

不羁的心 提交于 2019-12-03 11:07:07
问题 As I understand it, ASP.NET Core has support for OWIN middleware (via app.UseOwin() ) in addition to its own native middleware. What is the difference between ASP.NET Core middleware and OWIN middleware? When designing a new middleware, how do I know if I should design it as a ASP.NET Core middleware or a OWIN middleware? 回答1: Your question made me curious and I would like to share, what I have learned so far. Katana is the implementation of the OWIN spec. After version 3.0 of Katana this

Middleware to set response ContentType

不想你离开。 提交于 2019-12-03 10:31:01
In our ASP.NET Core based web application, we want the following: certain requested file types should get custom ContentType's in response. E.g. .map should map to application/json . In "full" ASP.NET 4.x and in combination with IIS it was possible to utilize web.config <staticContent>/<mimeMap> for this and I want to replace this behavior with a custom ASP.NET Core middleware. So I tried the following (simplified for brevity): public async Task Invoke(HttpContext context) { await nextMiddleware.Invoke(context); if (context.Response.StatusCode == (int)HttpStatusCode.OK) { if (context.Request

ASP.NET Core middleware or OWIN middleware?

纵然是瞬间 提交于 2019-12-03 04:45:52
As I understand it, ASP.NET Core has support for OWIN middleware (via app.UseOwin() ) in addition to its own native middleware. What is the difference between ASP.NET Core middleware and OWIN middleware? When designing a new middleware, how do I know if I should design it as a ASP.NET Core middleware or a OWIN middleware? Your question made me curious and I would like to share, what I have learned so far. Katana is the implementation of the OWIN spec. After version 3.0 of Katana this technology has been fully integration in the web stack we know as ASP.NET Core today. While this transition

No conversion available between HelloWorldComponent and System.Func`2[System.Collections.Generic.IDictionary`2 // Parameter name: signature

大憨熊 提交于 2019-12-01 18:17:11
I am working through Scott Allen's MVC 5 Fundamentals course on Pluralsight I get an error at "using (WebApp.Start(uri)) " in the code below. The error is An unhandled exception of type 'System.ArgumentException' occurred in Microsoft.Owin.dll System.ArgumentException was unhandled HResult=-2147024809 Message=No conversion available between ConsoleApplication1.HelloWorldComponent and System.Func`2[System.Collections.Generic.IDictionary`2[System.String,System.Object],System.Threading.Tasks.Task]. Parameter name: signature Source=Microsoft.Owin ParamName=signature StackTrace: at Microsoft.Owin

Why middleware in ASP.NET Core requires specific semantics, but not an interface?

风格不统一 提交于 2019-12-01 14:55:58
As known, IApplicationBuilder of the method Configure (class Startup) in ASP.NET Core requires specific semantics (to have method 'Invoke' with input parameter of HttpContext type and Task as return value). But why it's not implemented as interface? I can write something like it: public class FakeMiddleware { } and register it: app.UseMiddleware<FakeMiddleware>(); and we'll get an runtime error. Of course, it's trivial thing and easy to be found and fix, but it's implemented so rough, without interface? The Invoke method is flexible and you can ask for additional parameters. ASP.NET will

Why middleware in ASP.NET Core requires specific semantics, but not an interface?

烂漫一生 提交于 2019-12-01 13:41:30
问题 As known, IApplicationBuilder of the method Configure (class Startup) in ASP.NET Core requires specific semantics (to have method 'Invoke' with input parameter of HttpContext type and Task as return value). But why it's not implemented as interface? I can write something like it: public class FakeMiddleware { } and register it: app.UseMiddleware<FakeMiddleware>(); and we'll get an runtime error. Of course, it's trivial thing and easy to be found and fix, but it's implemented so rough, without

Bad Request (400) when using Web API Token Authentication from Angular JS

試著忘記壹切 提交于 2019-12-01 06:37:46
I want to establish Web API Token Authentication with Angular JS as client. I am very new to this concept of Token Authentication inside Web API. I do not want to use ASP.NET Identity default tables to add or authenticate user. I have my own database and a table called "EmployeeAccess" table which contains EmployeeNumber as User Id and Password. I want to authenticate the users against the values in this table and then want to grant token so that they gets authorized for subsequent call. I have used all required OWIN and ASP.NET References to achieve the result. Here is my code of different