owin

Authentication / Authorization MVC 5 and Web API - Katana/Owin

纵然是瞬间 提交于 2019-12-31 10:46:58
问题 I'm having problems trying to decide on a route to take on a project I have. I've been reading up on OWIN specs and Katana implementation within .NET. The reason why I'd like to go with the Katana route is because of the owin components associated with ADFS and Token/Cookie generation. I have two projects, one for MVC 5 website, and one for Web API. They may rest of two separate servers in the future, but for now they are on the same. I know I will be using IIS, so the Owin pipeline isn't

OWIN + SignalR + Autofac

雨燕双飞 提交于 2019-12-31 09:47:10
问题 Taken from: http://docs.autofac.org/en/latest/integration/signalr.html: "A common error in OWIN integration is use of the GlobalHost. In OWIN you create the configuration from scratch. You should not reference GlobalHost anywhere when using the OWIN integration." That sounds reasonable. However, how should one resolve IHubContext from an ApiController, like the usual (non-OWIN): GlobalHost.ConnectionManager.GetHubContext<MyHub>() ? I can't find a reference on this one anywhere, and the only

Error renaming ASP.NET MVC project

倖福魔咒の 提交于 2019-12-31 08:07:31
问题 I have copied a previous project and renamed it. Once I had successfully renamed all the name spaces and it build correctly. I got the following error when I ran the application: The following errors occurred while attempting to load the app. - The OwinStartup attribute discovered in assembly 'User Manager Interface' referencing startup type 'User_Manager_Interface.Startup' conflicts with the attribute in assembly 'Service Monitor Web Interface' referencing startup type 'Service_Monitor_Web

Unable to mock Owin context in C# WEB API REST service unit test

≯℡__Kan透↙ 提交于 2019-12-31 02:09:41
问题 I am trying to mock the OWIN context in a C# WEB API REST service but the OWIN context always seems to be null. I am using moq and .NET framework 4.5.2. Here is the controller method I am trying to test: public class CustomerController : ApiController { // GET: api/Customer/n [HttpGet] [ClaimsPrincipalPermission(SecurityAction.Demand, Operation = Actions.View, Resource = Resources.Self)] public IHttpActionResult Get(int id) { if (id <= 0) return BadRequest(); ClaimsPrincipalPermission

Any way to get OWIN to host a SOAP service?

微笑、不失礼 提交于 2019-12-30 18:55:17
问题 How do I get OWIN to host a SOAP endpoint (do not care if WCF is or isn't involved, SOAP gives WSDL which makes services easier to consume by certain clients, that's why I want SOAP and REST) I suspect the answer is: Implement your own middleware that hosts a SOAP endpoint. If that's the answer so be it, but that's a lot of work so I'll probably just end up sticking with WCF and avoiding OWIN if that's the case. I find it hard to believe no one has implemented a SOAP hosting middleware yet...

How to force account login for a single account user with Google's OAuth 2.0?

佐手、 提交于 2019-12-30 09:44:32
问题 Sometimes when a user logins into a site with Google's OAuth 2.0 they choose the wrong account to login with. Normally this isn't a problem if the user has more than one account registered with the browser, google will automatically show the user select screen: But if a user has only one account and is logged in, this screen is skipped. Instead I need Google's sign in panel to always appear, so that I can be sure the user has the option to try and enter the correct account. I tried using

How to force account login for a single account user with Google's OAuth 2.0?

余生长醉 提交于 2019-12-30 09:44:12
问题 Sometimes when a user logins into a site with Google's OAuth 2.0 they choose the wrong account to login with. Normally this isn't a problem if the user has more than one account registered with the browser, google will automatically show the user select screen: But if a user has only one account and is logged in, this screen is skipped. Instead I need Google's sign in panel to always appear, so that I can be sure the user has the option to try and enter the correct account. I tried using

ASP.NET MVC 5 (VS2013 final): Facebook login with OWIN fails (loginInfo is null)

人盡茶涼 提交于 2019-12-30 06:06:53
问题 I installed the VS2013 final bits that were released yesterday, and I'm trying to get an example working where I enable an external Facebook login. My first question: In this controller code (which I did not touch and left as is from the sample template): // // GET: /Account/ExternalLoginCallback [AllowAnonymous] public async Task<ActionResult> ExternalLoginCallback(string returnUrl) { var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); if (loginInfo == null) { return

Not able to validate JSON Web Token with .NET – key too short

匆匆过客 提交于 2019-12-30 05:23:33
问题 I have used JSONWebToken npm module to generate a jwt: var jwt = require('jsonwebtoken'); var payload = { "iss": "https://secure.example.com/", "exp": 1410819380, "http://example.com/orgnum": "987987987", "http://example.com/user": "me@example.com" }; var token = jwt.sign(payload, 'secret'); console.log(token); This gives me the following output: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9

Application_PreSendRequestHeaders() on OWIN

Deadly 提交于 2019-12-30 05:06:06
问题 I have an application that does not use OWIN middleware and has the following Global.asax : public class MvcApplication : HttpApplication { protected void Application_Start() { //... } protected void Application_PreSendRequestHeaders() { Response.Headers.Remove("Server"); } } This removes the Server header each time the application sends a response. How can I do the same with an application that uses OWIN? public class Startup { public void Configuration(IAppBuilder application) { //... } /