Questions tagged [owin-middleware]

OWIN Middleware in the IIS integrated pipeline

266 questions
4
votes
2 answers

Use OWIN middleware or a delegating MessgaeHandler to log api requests/responses?

In my old non-OWIN APIs, I use a MessageHanlder to log all HttpRequests and HttpResponses. Here is the MessageHandler: public class MessageHandler : DelegatingHandler { private static readonly ILog RequestApiLogger =…
BBauer42
  • 3,549
  • 10
  • 44
  • 81
3
votes
1 answer

HttpContext.Current is null in OpenId Connect OWIN middleware on SecurityTokenValidated

I'm working on a bug related to an OpenId Connect middleware (OWIN) in an ASP.NET Web Forms application which authenticates to Azure AD. I'm completely new to OWIN and OpenID, and did not write this code so bear with me. The solution was tested and…
3
votes
0 answers

Not able to fetch email and profile details through Google oauth in AuthenticationManager_GetExternalLoginInfoAsync_WithExternalBearer

While implementing Google oauth in of my website, I have encountered a problem where this API api/Account/RegisterExternal having function Authentication.GetExternalLoginInfoAsync() returns null. After hours of searching I found the above function…
raghav
  • 73
  • 1
  • 8
3
votes
0 answers

OwinMiddleware: System.ObjectDisposedException: Cannot access a disposed object

I am trying to make OwinMiddleware, which catches all user requests and logs it to DB. It works almost fine, but falls with System.ObjectDisposedException: Cannot access a disposed object when highloaded. public override async Task…
Ujinjinjin
  • 77
  • 1
  • 8
3
votes
0 answers

IdentityServer3 upgrade to .NET Framework 4.7 Error - "The provided RSA key is invalid"

We are trying to upgrade our IdentityServer3 instance from targeting .NET Framework 4.5 to 4.7 but stumbled on the following exception when running. The error seems to be occurring due to the absence of a cookie that OWIN Middleware is supposed to…
puri
  • 1,829
  • 5
  • 23
  • 42
3
votes
1 answer

How to integrate existing OwinMiddleware into a .Net Core 2.0 app pipeline?

I have a handful of existing Owin middleware classes, originally written for .Net 4.6 apps, that follow this pattern: public class MyMiddleware : OwinMiddleware { public MyMiddleware(OwinMiddleware next) : base(next) { } public override…
E-Riz
  • 31,431
  • 9
  • 97
  • 134
3
votes
2 answers

How to set TokenValidationParameters.NameClaimType to "username" instead of "name" for Azure AD B2C user?

I have the following code to configure the process of authentication in my ASP.NET MVC web application, including the setting a claim to the user's "name" when validating the user's identity token received by the application. (Note that I am…
aBlaze
  • 2,436
  • 2
  • 31
  • 63
3
votes
1 answer

OWIN Context is not initialized properly in ASP.NET Forms application

I'm new to OWIN and ADFS. I'm trying to authenticate users from ADFS using OWIN middleware. But when i run the app and perform login, the return HttpContext.Current.GetOwinContext() is not initialized properly. owin_middleware_startup.cs public…
zeee
  • 401
  • 1
  • 6
  • 16
3
votes
2 answers

Owin/Katana UseJwtBearerAuthentication Always Returns 401

I need to implement JWT Bearer Authentication in both a .NET 4.6.1 Web API project, as well as a .NET Core 2.0 web project. I successfully got the core project up and running with the this sample from Microsoft. I'm following this sample from Scott…
Tim_Cardwell
  • 236
  • 3
  • 15
3
votes
1 answer

Authenticating Users for Multiple Applications on same host name but different paths

I have two mvc 5 applications setup using OWIN-MixedAuth deployed to the same server. Each application is inside a separate folder and configured with its own app pool as follows: xyz.domain.com/MySiteA xyz.domain.com/MySiteB Web config for each…
adam78
  • 9,668
  • 24
  • 96
  • 207
3
votes
1 answer

OWIN authentication middleware: logging off

OWIN beginner here. Please be patient... I'm trying to build an OWIN authentication middleware which uses form posts to communicate with my external authentication provider. I've had some success with getting the authentication bits working. In…
Luis Abreu
  • 4,008
  • 9
  • 34
  • 63
3
votes
1 answer

Self-Hostable and IIS-hostable OWIN project

I would like to modify my solution to run under a self-hosted OWIN instance, but I also need it to run under http://localhost when necessary. How should I structure my Startup class to be recognised by both? Currently, I have the Web API project set…
Matt W
  • 11,753
  • 25
  • 118
  • 215
3
votes
1 answer

Web Api 2 OWIN Selfhost handle multiple concurrent requests

I have a selfhosted web api using OWIN, and I seems to struggle on concurrent connections. When I run a stress test with 50 concurrent get events, the response time is increasing A LOT, even tho the operation is quite simple, return 200 OK with the…
grmihel
  • 784
  • 3
  • 15
  • 40
3
votes
1 answer

OWIN/Katana middleware classic asp pages skipping pipeline

I have a classic asp app build on top of mvc 4.5 and I am trying to intercept calls for classic asp pages and it looks like I am not able to do that. Any ideas of how. Not sure how to have the middle ware intercept those requests. Looks like this…
bdawg
  • 343
  • 3
  • 13
3
votes
0 answers

Asp.net Web API 2 and mixed Authentication using both Integrated Windows and Token based

I have an asp.net Web API server running under IIS, that until now has used windows authentication as it has only had other services running on the same domain conencting to it. So, in my web.config I have the following settings...