owin

Unauthorised webapi call returning login page rather than 401

人盡茶涼 提交于 2019-12-17 02:06:24
问题 How do I configure my mvc/webapi project so that a webapi method called from a razor view doesn't return the loginpage when its unauthorised? Its a MVC5 application which also has WebApi controllers for calls via javascript. The two methods below [Route("api/home/LatestProblems")] [HttpGet()] public List<vmLatestProblems> LatestProblems() { // Something here } [Route("api/home/myLatestProblems")] [HttpGet()] [Authorize(Roles = "Member")] public List<vmLatestProblems> mylatestproblems() { //

ASP.NET_SessionId + OWIN Cookies do not send to browser

别来无恙 提交于 2019-12-16 20:13:23
问题 I have a strange problem with using Owin cookie authentication. When I start my IIS server authentication works perfectly fine on IE/Firefox and Chrome. I started doing some testing with Authentication and logging in on different platforms and I have come up with a strange error. Sporadically the Owin framework / IIS just doesn't send any cookies to the browsers. I will type in a username and password which is correct the code runs but no cookie gets delivered to the browser at all. If I

503 Error when using NancyFx with Owin

萝らか妹 提交于 2019-12-14 03:53:48
问题 I'm trying to use NancyFx in combination with SignalR. In order to host both, I'm using Microsoft Owin. But unfortunately I always get an 503 (Service unavailable), when trying to access the REST-API via PostMen (REST-Api Client extension for chromium browsers). So I extracted the main ingredients to a more simple program, that allows me to switch between Nancy Selfhost and Owin. When using Nancy SelfHost, everything works fine, but using Owin I still got a 503 error. internal class Program {

Need Hangfire Dashboard IIS Integrated from Console App

天大地大妈咪最大 提交于 2019-12-14 02:27:20
问题 I am closely following the HangFire solution from: https://github.com/HangfireIO/Hangfire.Samples/blob/master/Hangfire.WindowsServiceApplication/Program.cs The solution starts up the HangFire dashboard as a self hosting web site. I need it integrated with IIS, so the dashboard is accessible outside the server. I don't want to always log into the server, open a browser, and go to local host and some port number. Help me!!!! 回答1: A coworker found the answer. They used the following website help

Failing OpenID Connect middleware - how to debug?

≡放荡痞女 提交于 2019-12-13 16:12:13
问题 I set up a very simple ASP.NET MVC 5 application that tries to authenticate a user through an OpenID provider in Authorization Code mode. I'm able to log in and the server returns a code in the redirect URL querystring and a nonce cookie. However, back on the client application the user is not authenticated ( User.Identity.IsAuthenticated false), has no claims and called controller Action that has an Authorize attribute is never carried out. Browser stays on the redirect URL page which is the

WSO2 Identity Server OpenId Connect Owin

淺唱寂寞╮ 提交于 2019-12-13 14:13:05
问题 Im trying to set up WSO2 Identity Server to use OpenId connect. I have currently applied the following settings shown Here: Setup WSO2. What it boiles down to is that i use the Resident Identity Provider and i have setup a Service Provider for my app "CoolApp". I configured "OAuth/OpenID Connect Configuration" and set a callback URL. Is there a simple example how to use this in javascript? I have played around with identityserver3 and they have a client oidc-client.js which works nicely in

Facebook OAuth stopped working suddenly

做~自己de王妃 提交于 2019-12-13 12:25:01
问题 I noticed yesterday that my Facebook login for my website has stopped working. This has been working great for the last 2 months, as far as I am aware I have not changed anything. I have tried everything I can on links such as: - as well as many more... ASP.NET MVC5 OWIN Facebook authentication suddenly not working I have noticed that the Stack Overflow Facebook auth has also stopped working. Has anyone else noticed this and found any solution? It's worth noting I am using azure app services

Authentication using OAuth in Web API

被刻印的时光 ゝ 提交于 2019-12-13 11:53:00
问题 I'm working on a project using ASP.Net MVC5 which also includes a Web API. The API will be for internal use only. I'm using the OWIN library to provider authentication. I'm having a difficult time figuring out how to correctly implement authentication through the API. I was planning on using OAuth 2.0 but the problem with OAuth is that the user needs to login through a browser page instead of a native login screen. So I was wondering if it is possible to somehow skip the browser. I've found

Redirect to ReturnUrl after successful cookie authentication in Owin, Katana & Nancy

独自空忆成欢 提交于 2019-12-13 11:43:52
问题 I am using Owin, Katana and Nancy to host a simple site with an authentication required section. Note I am also using nuget package - Nancy.MSOwinSecurity app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.AuthenticationType, LoginPath = new PathString("/Login"), }); app.UseNancy(); Here is my module code public class LoginModule : NancyModule { public LoginModule() { Post["login"] = p => { var name = Request.Form.name; var auth = Context

Web API Controller method executes to end. No HTTP response. Hangs

我们两清 提交于 2019-12-13 09:06:26
问题 I am looking for an approach to debugging this scenario. I have verified in Fiddler that there is no HTTP response at all. To be clear, as I understand it a controller method should not simply hang, there is no exception. I have verified the lack of response in Fiddler. The method returns a valid object, verified by stepping through the code to the final return statement. This is different from the original question in that the controller method is hit, and was not before. The reason for this