katana

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

SecurityTokenSignatureKeyNotFoundException when validating JWT signature

拟墨画扇 提交于 2019-12-04 00:34:37
问题 I'm trying to implement the OpenID Connect specification for my organisation. I'm using Microsoft's OWIN implementation of OpenID Connect in a test relying party application to verify my implementation of the protocol. I've exposed the following metadata document: { "issuer": "https://acs.contoso.com/", "authorization_endpoint": "http://localhost:53615/oauth2/auth", "token_endpoint": "http://localhost:53615/oauth2/token", "userinfo_endpoint": "http://localhost:53615/connect/userinfo", "jwks

OWIN app.use vs app.run vs app.map

人盡茶涼 提交于 2019-12-03 22:49:19
What's the difference among app.use , app.run , app.map in Owin ? When to use what? It's not straightforward when reading the documentation. app.use inserts a middleware into the pipeline which requires you to call the next middleware by calling next.Invoke(). app.run inserts a middleware without a next, so it just runs. With app.map you can map paths, which get evaluated at runtime, per request, to run certain middleware only if the request path matches the pattern you mapped. See docs for use and run and map for more details app.Run The nature of Run extension is to short circuit the HTTP

Changing the response object from OWIN Middleware

偶尔善良 提交于 2019-12-03 19:00:53
问题 My OWIN middleware is like this. (Framework is ASP.NET Web API). public class MyMiddleware : OwinMiddleware { public MyMiddleware(OwinMiddleware next) : base(next) { } public override async Task Invoke(OwinRequest request, OwinResponse response) { var header = request.GetHeader("X-Whatever-Header"); await Next.Invoke(request, response); response.SetHeader("X-MyResponse-Header", "Some Value"); response.StatusCode = 403; } } Questions: Is it the recommended practice to derive from

Configure Application Permissions in Azure AD

萝らか妹 提交于 2019-12-03 15:10:09
问题 Background I have a Web API registered in Azure AD and secured using WindowsAzureActiveDirectoryBearerAuthentication (OAuth2 bearer token). This is a B2B-type scenario where there are no interactive users - the applications calling the API are daemon-like background apps. As such, I don't need any consent experience - I just want trusted applications to be able to call the API, and other applications - even if they present a valid OAuth token - to be denied. What I've tried This sample seemed

Redirect to ReturnUrl after successful cookie authentication in Owin, Katana & Nancy

一笑奈何 提交于 2019-12-03 13:33:18
I am using Owin, Katana and Nancy to host a simple site with an authentication required section. Note I am also using nuget package - Nancy.MSOwinSecurity app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.AuthenticationType, LoginPath = new PathString("/Login"), }); app.UseNancy(); Here is my module code public class LoginModule : NancyModule { public LoginModule() { Post["login"] = p => { var name = Request.Form.name; var auth = Context.GetAuthenticationManager(); var claims = new List<Claim> {new Claim(ClaimTypes.Name, name)}; var id = new

How do I enable Application Insights server telemetry on WebApi project that uses OWIN?

六眼飞鱼酱① 提交于 2019-12-03 11:25:18
问题 We are having a bunch of problems (read long response times) with a couple of projects in production and wanted to see exactly what was happening on the server. I then proceeded to add Application Insights to all of our projects by following this article. The problem is that both of our WebAPI projects are not sending server data to the Azure portal, while all other projects (MVC 5) are. This is what is shown when I access the corresponding Application Insights blade on Azure: I tried to

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

ぃ、小莉子 提交于 2019-12-03 09:53:21
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.Response.WriteAsync("Hello Owin!")); } } } However when I run the console app I get a message Unhandled

Authentication with Microsoft.Owin.Testing.TestServer for In-Memory Integration Tests

末鹿安然 提交于 2019-12-03 08:48:16
问题 I've just moved to using OWIN\Katana for a web api project. It uses Windows Authentication. This seems to be working, but most of my integration tests have broken. They were previously just using an In-Memory HttpServer but I've changed to using Microsoft.Owin.Testing.TestServer . I've replaced something like this in my test setup: var config = new HttpConfiguration { IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always }; config.EnableQuerySupport(); Server = new HttpServer(config);

OWIN send static file for multiple routes

天大地大妈咪最大 提交于 2019-12-03 08:20:06
问题 I'm making a SPA which sits on top of ASP.Net WebAPI. I'm waiting to use HTML5 history rather than #/ for history routing but that poses a problem for deep linking, I need to make sure / and /foo/bar all return the same HTML file (and my JS will render the right part of the SPA). How do I get OWIN/Katana to return the same HTML file for multiple different urls? 回答1: To make things simple, while still keeping all the caching goodness etc. from the StaticFiles middleware, I'd just rewrite the