owin

OAuth Refresh Token does not deserialize / invalid_grant

妖精的绣舞 提交于 2019-12-08 09:03:32
问题 I have followed the wonderful tutorial by Taiser Joudah for implementing refresh tokens with Asp.Net Web Api 2 and Owin. It all went so well...except I can't get it to work. :-) It all "seems" like it works up until the point I request a refresh token. Then all I get back is: “error”: “invalid_grant” and no description to go with. One of the comments on that post had the same symptom and the response was to generate a MachineKey for the web.config. I tried this but it didn't help. And I'm

asp.net mvc5 forms authentication, how does OWIN come in to place?

匆匆过客 提交于 2019-12-08 08:13:08
问题 I started a new MVC5 project and am implementing forms authentication (which I used to do using custom code to check the user credentials and the FormsAuthentication object to login and logoff). Now I've read that the identity model has changed, but I saw this line of code in the generated code: private IAuthenticationManager AuthenticationManager { get { return HttpContext.GetOwinContext().Authentication; } } Because later on the login is done on that object ( AuthenticationManager.SignIn )

How to trap a WS-Federation callback in an OWIN MVC5 app to automatically create an identity in local database?

会有一股神秘感。 提交于 2019-12-08 08:12:55
问题 I am currently working on a vb.net MVC5 application and using WS-Federation to authenticate all the users from an ADSF 3.0 server. Everything is working fine; when the users try to access a secured controller marked with the AUTHORIZE attribute, the users are redirected to the STS login page, they login and they come back. I am able to read the CLAIMS provided by the ADFS server. My problem is that i need to create a local entry in my database when a new authenticated user comes in after

Host Swagger UI 3.0 Dist folder using OWIN

南楼画角 提交于 2019-12-08 07:50:51
问题 I want to self-host the Swagger UI Dist folder on a Web Server using OWIN. I cannot use IIS to host Swagger UI. Most OWIN guides only talk about hosting Web API projects. How can I do that? The reason I want to do this is that I already have a separate project that generates the Open API/Swagger v3.0 schema docs. So I have the specs ready, I just need a way to host/show them on the Swagger UI. And this Swagger UI project needs to be self-hosted. See this - Add Swagger UI to a custom .NET Web

Override error code on AuthorizationCodeProvider.Create

故事扮演 提交于 2019-12-08 06:25:58
问题 This question is about the implementation of the Authorization Code flow using Owin in Asp.net Wep Api. I was trying to handle some error that might happen on my AuthorizationCode code creation. Apparently I can't redirect my self to the Client Redirect URI with he correct error code which is "server_error" The following is my code : private static void CreateAuthorizationCode(AuthenticationTokenCreateContext context) { try { //Some Code to create and save the AuthorizationCode that can throw

Owin- Slow CompatibleWithModel call

大兔子大兔子 提交于 2019-12-08 03:47:37
问题 I have this line of code within a request of an ApiController of an Azure Mobile App Web API : var user = t.TrackDependency(() => context.Users.SingleOrDefault(x => x.Email == loginRequest.Id || x.Name == loginRequest.Id), "GetUser"); Here is the result from Application Insights: We can see that while the line of code took 2613ms, the actual query call to the database took 190ms. While this is an edge case it happens often enough to get complaining users about slow performance. The thing is I

Get remote ip while using Owin.Testing

五迷三道 提交于 2019-12-08 03:15:26
问题 I'm using Owin.Testing as test env. In my controller i need to get remote ip address from the caller. //in my controller method var ip = GetIp(Request); Util private string GetIp(HttpRequestMessage request) { return request.Properties.ContainsKey("MS_HttpContext") ? (request.Properties["MS_HttpContext"] as HttpContextWrapper)?.Request?.UserHostAddress : request.GetOwinContext()?.Request?.RemoteIpAddress; } As a result Properties does not contains MS_HttpContext and RemoteIpAddress of

Owin WebApi service ignoring ExceptionFilter

点点圈 提交于 2019-12-08 02:15:14
问题 Stack, For some reason my Owin WebApi service is ignoring our custom exception handler. I'm following documentation for asp.net exception handling. Here are the simplified implementation details (scrubbed out business proprietary stuff). Can you someone point out what I'm overlooking? Custom exception filter: public class CustomExceptionFilter : ExceptionFilterAttribute { public override void OnException(HttpActionExecutedContext actionExecutedContext) { actionExecutedContext.Response

Create Self Hosted Web API or Use Asp.Net Core Web API?

不问归期 提交于 2019-12-08 02:06:10
问题 I have two options: If I self host Wep Api uisng OWIN/Katana I can have the performance gain but as mentioned here, I have to write code to have the features of IIS like logging, application pool scaling, throttling etc. Instead can I create API using Asp.Net Core which doesn't use unnecessary System.Web request pipeline ? And use the IIS features or Nginx Server features ? With performance in mind which is the best option ? Update: I mean , I don't want to use IIS , but i want to self host

NancyFx on IIS and Windows Authentication

烈酒焚心 提交于 2019-12-08 02:04:08
问题 I have converted a MVC + AngularJS application to use NancyFx + AngularJS (as I wasn't really using any MVC stuff). I am using VS2013 and it runs under IIS (and IIS Express in my dev environment). I can obtain the current logged in user by examining the server.User component of the OwinEnvironment. I am currently using Microsoft.Owin.Host.SystemWeb as per most of the demos. When I add a RequiresAuthentication to a Get request in my module, I get a pop-up in IE to enter credentials even though