Questions tagged [owin-middleware]

OWIN Middleware in the IIS integrated pipeline

266 questions
1
vote
1 answer

How to add a request identifier to OWIN requests using Serilog?

I'm trying to get the same as with using SerilogWeb.Classic.WebApi using this: app.Use(async (owinContext, next) => { using (Serilog.Context.LogContext.PushProperty("HttpRequestId", Guid.NewGuid())) { await next(); } }); and…
Paulo Morgado
  • 14,111
  • 3
  • 31
  • 59
1
vote
2 answers

OWIN middleware does not get invoked for all requests

I am trying to add content security policy header in response header for all requests. So I have created OWIN middleware public class SecurityHeaderMiddleware { private readonly INonceService _nonceService = null; private readonly Func
LP13
  • 30,567
  • 53
  • 217
  • 400
1
vote
1 answer

How to create OWIN middleware per request

I am implementing a custom owin middleware to add CSP header (content security policy) in response header. For CSP to work, the middleware needs to create a unique nonce value per request. So i have NonceService which creates nonce value. The custom…
LP13
  • 30,567
  • 53
  • 217
  • 400
1
vote
1 answer

OwinHost.exe from command line - how to make it start on a different port?

Yes, I have looked on google for this seeming simple question w/o much luck. So my project includes the OwinHost (OwinHost.exe) NuGet package, and this has updated my project in such a way as to allow the Visual Studio IDE, via property pages, to…
bkwdesign
  • 1,953
  • 2
  • 28
  • 50
1
vote
0 answers

Owin/Katana, Basic Authentication and WindowsIdentity

We are building a ASP.NET Web API 2 service self-hosted in OWIN/Katana. Because of some security requirements the app uses Basic Authentication, which results in System.Web.Http.ApiController.RequestContext.Principal.Identity being of type…
Alex I
  • 2,078
  • 3
  • 18
  • 24
1
vote
0 answers

Unable to reference a target web app project for Unit Testing

I created a .NET Core web app in VS2015 using the empty web app template. It targets the full framework 4.6.1. It is for a middleware which I am using across a number of other web apps. I followed the instructions here, and the middleware works when…
Frank Fajardo
  • 7,034
  • 1
  • 29
  • 47
1
vote
0 answers

Send Response using OWIN Middleware Web API

I am trying to customize access token json object in my Web APi 2 project. Which I have done successfully. But I am unable to figure out the case of failed request. Here is my custom response:- { data: {}, success: 0, message: "failed" } And…
Adnan Ahmed
  • 844
  • 6
  • 19
1
vote
1 answer

Global Error Handling in Service Fabric Stateless Web API

How should I handle global exception handling for my controller methods in stateless web API? My goal is to avoid verbosity of try/catch statements inside my controller. I was able to achieve this with IIS hosted Web API using a custom…
alltej
  • 6,787
  • 10
  • 46
  • 87
1
vote
1 answer

Autofac, OWIN, and temporary per-request registrations

I have a question about creating a temporary request scope when using the Web API OWIN pipeline with Autofac. We have the need to disable some external dependencies on demand so our QA team can test their negative test cases. I did not want to…
Ken Hundley
  • 3,833
  • 1
  • 13
  • 8
1
vote
0 answers

How do I access the OWIN instance per request DbContext in my action methods?

I never even noticed this code: ' Configure the db context and user manager to use a single instance per request app.CreatePerOwinContext(AddressOf ApptDbContext.Create) So I had even written a DbContext filter, to create and dispose an…
ProfK
  • 49,207
  • 121
  • 399
  • 775
1
vote
1 answer

IdentityServer, ASP.NET Core and Web API

I have setup the IdentityServer4 and another client ASP.NET Core application. The Client needs to authenticate with the IdentityServer and request access to a third application which is standard MVC Web API project. i have followed the steps to…
zdrsh
  • 1,667
  • 1
  • 14
  • 26
1
vote
1 answer

How to configure Swagger in Web API 2 to POST OAuth2 authentication request?

I have recently started a Web API 2 project in Visual Studio 2012 using OWIN middleware to authenticate users with OAuth2. I incorporated token based authentication as outlined on this tutorial (Token Based Authentication). The authentication part…
Sebbo
  • 405
  • 2
  • 9
  • 15
1
vote
0 answers

How to tell ConfigureAuth which is the current web application host name?

I want to load CookieDomain and set the external providers based on values from database, but it seems like HttpContext.Current.Request.Url.Host is not yet set when Startup is calling ConfigureAuth(app); (value is always 127.0.0.1) How can I get the…
Yovav
  • 2,557
  • 2
  • 32
  • 53
1
vote
1 answer

Middleware that calls other middlewares

I have some piece of ASP.NET Core code that I want to extract into a custom middleware. Specifically, the following logic should be implemented: when a certain path mapPath is requested, proxy the request to another host, identified by proxyUrl. The…
Matthias
  • 3,403
  • 8
  • 37
  • 50
1
vote
3 answers

OWIN losing Identity on OData $batch requests

I'm trying to move my standard WebApi app over to OWIN, but having a problem with identities and $batch requests. I currently have a DelegatingHandler that detects and assigns the identity in SendAsync: // Detect bearer token and build the identity…
Tim
  • 2,968
  • 5
  • 29
  • 55