owin

Validating Google OpenID Connect JWT ID Token

不羁的心 提交于 2019-12-17 22:22:37
问题 I'm trying to upgrade my MVC website to use the new OpenID Connect standard. The OWIN middleware seems to be pretty robust, but unfortunately only supports the "form_post" response type. This means that Google isn't compatible, as it returns all the tokens in a the url after a "#", so they never reach the server and never trigger the middleware. I've tried to trigger the response handlers in the middleware myself, but that doesn't seem to work at all, so I've got a simply javascript file that

Can't get ASP.NET Web API 2 Help pages working when using Owin

你离开我真会死。 提交于 2019-12-17 22:20:02
问题 I've installed the correct package for Web Api 2 Install-Package Microsoft.AspNet.WebApi.HelpPage -Pre But the help area is not being mapped and is returning 404 (Web Api working fine). I'm using Microsoft.Owin.Host.SystemWeb as the host. Below is my Startup code. public class Startup { public void Configuration(IAppBuilder app) { //Required for MVC areas new HttpConfiguration() doesn't work with MVC var config = GlobalConfiguration.Configuration; AreaRegistration.RegisterAllAreas();

MVC 5 How to define Owin LoginPath with localized routes

ぐ巨炮叔叔 提交于 2019-12-17 21:46:25
问题 I have a MVC 5 website with localized routes defined as routes.MapRoute( name: "Default", url: "{culture}/{controller}/{action}/{id}", defaults: new { culture = CultureHelper.GetDefaultCulture(), controller = "Home", action = "Index", id = UrlParameter.Optional } ); Where the default culture results in "en-US" . The problem arises when on startup I have to define the login url using the LoginPath property, that is set once and it will always use the provided value, e.g. the default culture if

How do I ignore the Identity Framework magic and just use the OWIN auth middleware to get the claims I seek?

穿精又带淫゛_ 提交于 2019-12-17 21:41:10
问题 The OWIN middleware stuff to integrate third-party logins to your ASP.NET app is very cool, but I can't seem to figure out how to tear it out from the new ID framework that replaces the crappy Membership API. I'm not interested in persisting the resulting claims and user info in that EF-based data persistence, I just want the claims info so I can apply it to my own user accounts in existing projects. I don't want to adopt the new ID framework just to take advantage of this stuff. I've been

SignalR 2.0.2 and Owin 2.0.0 dependency conflict

这一生的挚爱 提交于 2019-12-17 18:46:07
问题 I'm trying to get SignalR working in an MVC5 project with individual accounts. The MVC project has by default Owin 2.0.0 and all of the Owin.* components are also 2.0.0. So I used NuGet to get all the SignalR packages, it automatically resolved dependancies and downloaded v 2.0.2. The project throws an error on startup with the following message: Could not load file or assembly 'Microsoft.Owin, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' I also tried upgrading Owin to 2

Global exception handling in OWIN middleware

风格不统一 提交于 2019-12-17 17:31:35
问题 I'm trying to create a unified error handling/reporting in ASP.NET Web API 2.1 Project built on top of OWIN middleware (IIS HOST using Owin.Host.SystemWeb). Currently I used a custom exception logger which inherits from System.Web.Http.ExceptionHandling.ExceptionLogger and uses NLog to log all exceptions as the code below: public class NLogExceptionLogger : ExceptionLogger { private static readonly Logger Nlog = LogManager.GetCurrentClassLogger(); public override void Log

How to know when OWIN cookie will expire?

北战南征 提交于 2019-12-17 15:37:07
问题 I would like to create some kind of countdown timer based on the time the OWIN cookie will expire. I am using OWIN with MVC 5 and from what I understand SlidingExpiration is on by default. I do not use 'session' as I need this app to live within a web farm (I dont plan on deploying a session database). 回答1: All you need is to get hold of the CookieValidateIdentityContext during the cookie validation stage. Once you get it, extract whatever you need and keep them as Claim or some other way

Hosting WebAPI using OWIN in a windows service

别来无恙 提交于 2019-12-17 15:23:37
问题 I've self-hosted Web API using OWIN (inside a windows service). From what I understand, this is enough to make HTTP requests come to the windows service. I'm able to hit the WebAPI URL ( http://localhost/users ) locally (from the same machine), but not from other machines. I'm using port 80, IIS is stopped . Other websites (hosted in IIS, on port 80) work fine when IIS is running. //In the windows service: public partial class Service1 : ServiceBase { ... ... protected override void OnStart

Too many cookies OpenIdConnect.nonce cause error page “Bad Request - Request Too Long”

一世执手 提交于 2019-12-17 10:34:27
问题 I'm using OWIN / OAuth with OpenId Connect authentication ( Microsoft.Owin.Security.OpenIdConnect ) in a C# ASP MVC web app. The SSO login with Microsoft account basically works, but from time to time I'm getting an error page on the browser that says Bad Request - Request Too Long . I found out that this error is caused by too many cookies. Deleting cookies helps for some time, but after a while the problem comes back. The cookies that cause the problem are set from OpenId framework, so

Self hosted OWIN and urlacl

人走茶凉 提交于 2019-12-17 07:26:11
问题 I've created a self hosted Nancy/SignalR application self-hosted in OWIN using Microsoft.Owin.Host.HttpListener and Microsoft.Owin.Hosting Things work perfectly fine locally but as soon as I try to use anything but localhost to access the app I get a HTTP Error 503. The service is unavailable error. I can't even access the app using 127.0.0.1 or the machine name. I've tried adding the port to urlacl using http add urlacl http://*:8989/ user=EVERYONE but doesn't seem to do anything. here are