katana

OWIN OnSendingHeaders Callback - Reading Response Body

本小妞迷上赌 提交于 2019-12-02 18:43:13
问题 This question is related to the excellent answer by Youssef. I love OnSendingHeaders callback. I can now add the response headers without worrying about switching streams. Anyways, here is my question. Is it possible to read the response body inside the callback, like so. public override async Task Invoke(OwinRequest request, OwinResponse response) { request.OnSendingHeaders(state => { var resp = (OwinResponse)state; // Here, I want to convert resp, which is OwinResponse // to

OWIN OnSendingHeaders Callback - Reading Response Body

二次信任 提交于 2019-12-02 08:44:32
This question is related to the excellent answer by Youssef. I love OnSendingHeaders callback. I can now add the response headers without worrying about switching streams. Anyways, here is my question. Is it possible to read the response body inside the callback, like so. public override async Task Invoke(OwinRequest request, OwinResponse response) { request.OnSendingHeaders(state => { var resp = (OwinResponse)state; // Here, I want to convert resp, which is OwinResponse // to HttpResponseMessage so that when Content.ReadAsStringAsync // is called off this HttpResponseMessage object, I want

Web API app with OWIN 'SystemWeb' on Azure App Service

陌路散爱 提交于 2019-12-01 20:47:35
问题 I am creating app which uses Identity 2.1.0 framework in .NET. I started project in Visual Studio 2015 as Empty Web App (template). Now, I use Microsoft.AspNet.WebApi.Owin , and also Microsoft.Owin.Host.SystemWeb NuGet packages in my project. I understand that OWIN is a specification made to avoid monolithic frameworks and to specify how smaller application components interact with servers. However, I have requirement to deploy to Azure App Services. I have found examples (blogs) where people

Web API app with OWIN 'SystemWeb' on Azure App Service

自古美人都是妖i 提交于 2019-12-01 18:32:56
I am creating app which uses Identity 2.1.0 framework in .NET. I started project in Visual Studio 2015 as Empty Web App (template). Now, I use Microsoft.AspNet.WebApi.Owin , and also Microsoft.Owin.Host.SystemWeb NuGet packages in my project. I understand that OWIN is a specification made to avoid monolithic frameworks and to specify how smaller application components interact with servers. However, I have requirement to deploy to Azure App Services. I have found examples (blogs) where people deploy OWIN Web Api app as self-hosted to the Azure Cloud Services worker role. But I don't want this,

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

OWIN openid connect external login doesn't execute specified callback url

你说的曾经没有我的故事 提交于 2019-12-01 11:58:57
问题 I am using owin openid connect authentication where the authentication provider is hosted on a separate domain. The authentication process works nicely. I am able to view restricted pages upon successful login at the identity server. But I want the external identity server to return back to "account/SignInCallback" controller action so that I can execute a few lines of code relevant for the member's account. In the browser's network activity it shows me "302 Found" for the "account

AuthenticationProperties.RedirectUri is not passed to Google in Challenge()

南楼画角 提交于 2019-12-01 11:21:47
Within my web application I have registered Google as a single sign-on provider: app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions { ClientId = "8765.......apps.googleusercontent.com", ClientSecret = "Secret" }) My app doesn't allow users to sign-up/register (instead their accounts are created by an administrator, but they can later link their account up with Google). In my "Sign in with Google" controller, I am trying to issue a Challenge() to redirect to Google. This might not be thecorrect approach: string redirectUri = "http://localhost:55262/SSO/Google/ProcessToken"; //

Finish current requests when stopping self-hosted owin server

一曲冷凌霜 提交于 2019-12-01 03:29:19
问题 I have OWIN server as part of console app. You can see the main method here: class Program { public static ManualResetEventSlim StopSwitch = new ManualResetEventSlim(); static void Main(string[] args) { Console.CancelKeyPress += (s, a) => { a.Cancel = true; StopSwitch.Set(); }; using (WebApp.Start<Startup>("http://+:8080/")) { Console.WriteLine("Server is running..."); Console.WriteLine("Press CTRL+C to stop it."); StopSwitch.Wait(); Console.WriteLine("Server is stopping..."); } Console

SecurityTokenSignatureKeyNotFoundException when validating JWT signature

冷暖自知 提交于 2019-12-01 03:13:24
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_uri": "http://localhost:53615/connect/keys", "ui_locales_supported": [ "en-GB" ] } The signing key is

Pass command-line arguments to Startup class in ASP Core

江枫思渺然 提交于 2019-12-01 03:12:29
I have arguments passed in via the command-line private static int Main(string[] args) { const string PORT = "12345" ; var listeningUrl = $"http://localhost:{PORT}"; var builder = new WebHostBuilder() .UseStartup<Startup>() .UseKestrel() .UseUrls(listeningUrl); var host = builder.Build(); WriteLine($"Running on {PORT}"); host.Run(); return 0; } One of these arguments is a logging output directory. How do I get this value into my Startup class so I can write out to this directory when I receive a request? I'd like to avoid using a static class. Would a service that supplies the value be the