owin

WebApp.Start() calls Startup Configuration twice

点点圈 提交于 2019-12-11 15:45:42
问题 I'm hosting Web API and SignalR client in a Windows service. Any code after the WebApp.Start is getting executed twice. Also requests to the Web APIs are also received twice. Below is my sample code, in this TestSignalRService:3 and traces in configuration are getting printed twice. My App.config is also pretty basic and doesn't have any settings. public partial class Service1 : ServiceBase { public Service1() { InitializeComponent(); } IDisposable SignalR; HttpSelfHostServer server;

How access token is validated for accessing protected resources in token based mechanism?

梦想的初衷 提交于 2019-12-11 15:29:40
问题 I want to do token based mechanism where I would be having either SPA or mobile apps supporting multiple clients. Use case of my web service engine and my application: My web application: Client will do registration of their application either SPA or mobile apps.They will get client id on registration.Only client id as secret key would be compromised in case of SPA or mobile apps hence I am just providing clientid. Web service engine: Support multiple client with managing session of each user

Send a custom parameter to an external identity provider

我怕爱的太早我们不能终老 提交于 2019-12-11 14:57:19
问题 Is it possible to send a custom parameter to an external login provider/custom owin middleware I have an Identity Server 3 who handles my authentication, and I have an external identity provider middleware which handles the signing in of the user, to sign in I have to send a token to the middleware, which the middleware uses to authenticate. I tried following approaches: acr_values : I sent the token as a acr_value, but this approach does not work for 2 reasons: The token is to long( >900

OWIN - Access External Claims in subsequent requests

馋奶兔 提交于 2019-12-11 13:57:00
问题 I have an ASP.Net application that uses OWIN and External logins through a third party provider, specifically google. During Authentication, this code is used to pull the ClaimsIdentity from the OwinContext var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); where AuthenticationManager is private IAuthenticationManager AuthenticationManager { get { return HttpContext.GetOwinContext().Authentication; } } However, on subsequent requests (i.e. redirecting to the home page

Add SignalR persistent connection at runtime (self host)

给你一囗甜甜゛ 提交于 2019-12-11 12:36:24
问题 I'm trying to add a path for a persistent connection at runtime. I found an example using SignalR.Hosting.Self, Version=0.5.1.10822, which has the Server class. Using that class, it is possible to do this: server.MapConnection<PathOneConnection>("/Path1/"); server.Start(); server.MapConnection<PathTwoConnection>("/Path2/"); Which worked, so I began hopefully creating my solution - starting out by getting the nuget packages.... However the newer version of SignalR uses an IAppBuilder public

Route ALL requests through OWIN Middleware

放肆的年华 提交于 2019-12-11 12:25:27
问题 I am having some troubles getting some very basic OWIN middleware to handle all requests to the IIS application. I am able to get the OWIN middleware to load per page request but I need it to handle requests for images, 404s, PDFs, and everything that could possible be typed into an address bar under a certain host name. namespace HelloWorld { // Note: By default all requests go through this OWIN pipeline. Alternatively you can turn this off by adding an appSetting owin:AutomaticAppStartup

ASP.NET Identity Change ExpireTimeSpan after ConfigureAuth

元气小坏坏 提交于 2019-12-11 11:50:03
问题 I'm working on a web application that I recently migrated from a custom authentication solution to ASP.NET Identity. In some sections of our app, long processes are performed that can take up to an hour to run. Under normal circumstances, we want users to be automatically logged out after 30 minutes of non-activity. However, for screens where long processes occur, we want to widen the automatic logout window so that they don't get kicked out before the process completes. I'm currently

OWIN identity roles work locally, but seem to disappear when I publish/run the same code on a remote IIS server

本小妞迷上赌 提交于 2019-12-11 11:48:21
问题 Using an OWIN AuthenticationHandler within an MVC site, I sign in a user as follows: var claims = new List<Claim> { new Claim(ClaimTypes.Role, UIRoles.PowerUser) }; var identity = session.ToClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie, claims); Context.Authentication.SignIn(identity); At some point at a later time, I check that the user is a PowerUser : User.Identity.HasRole(UIRoles.PowerUser) This works on my local IIS, but once I publish it on a remote IIS machine, it always

Storing/Retrieving user data without database when using OWIN cookie authentication

谁都会走 提交于 2019-12-11 11:04:15
问题 How do I correctly store and retrieve data belonging to a user when using OWIN cookie authentication? No database is available. The data should preferably be available as long as the cookie remains valid. If that's not possible, it's acceptable if the user needs to re-login providing the data again if it is missing. Currently login is simply done using something similar to: // Check credentials here var claims = new List<Claim> { new Claim(ClaimTypes.Name, name) }; var id = new ClaimsIdentity

Owin Selfhost: deal with large files

╄→гoц情女王★ 提交于 2019-12-11 10:14:53
问题 I found this article: http://www.strathweb.com/2012/09/dealing-with-large-files-in-asp-net-web-api/ It tells how to set the TransferMode when Selfhosting with System.Web.Http.Selfhost. Is there a similar way to set the TransferMode to Streaming when selfhosting with Owin instead? 回答1: As far as I can tell Microsoft's Owin server already streams all uploads and downloads. How you handle this data in your WebApi (or equivalent) determines whether or not it gets fully buffered or stays as a