owin

Accessing cookie expiration time owin

夙愿已清 提交于 2020-01-02 07:11:22
问题 I am trying to access expiration time on Owin i am using the following example Access ExpireTimeSpan property of Owin Cookie Authentication to notify user of login expiry but i cant get to work. I get an error the key, value does exist. I would really appreciate if someone could point me to the right direction thanks. StartupAuth.cs var config1 = new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, //LoginPath = new PathString("/Account/Login"),

Run a .Net MVC5 application on Mono

给你一囗甜甜゛ 提交于 2020-01-02 06:43:10
问题 I am developing an .Net 4.5.1 MVC5 application in Visual Studio 2013 on Windows. Now I want to know, if it is possible to run this application on Linux ( Ubuntu 12.04 )? Would it be possible to use OWIN? 回答1: Owin can be run self hosted which means no IIS which is a start see here Use OWIN to Self-Host ASP.NET Web API Then to also help see this post about deploying to a mono instance on heroku Running OWIN/Katana apps on Heroku 来源: https://stackoverflow.com/questions/21455600/run-a-net-mvc5

Why does my site redirect back to the Login screen when I click an external provider button?

社会主义新天地 提交于 2020-01-02 05:03:11
问题 I'm upgrading an ASP.Net MVC4 site to MVC5, and implementing the new OWIN Authentication methods in the process. I've copied over the action methods from the Account controller on a blank MVC5 project. The problem is, when I click an external provider button (e.g. Google) I just get redirected back to the login page again. The second time I click it, I do get taken to the Google account page, but then the browser gets redirected to the Account/External login page. What's going on? 回答1: Check

How do I ask Owin/Katana to write headers to the output stream?

流过昼夜 提交于 2020-01-02 04:27:07
问题 When I write to the response, Katana skips sending out the Elapsed-Time response header. How can I have it set the headers for me before I write to the stream for the first time? Middleware #1 public override async Task Invoke(IOwinContext context) { var stopwatch = new Stopwatch(); stopwatch.Start(); await Next.Invoke(context); stopwatch.Stop(); context.Response.Headers.Add("Elapsed-Time", new[] {stopwatch.ElapsedMilliseconds.ToString()}); } Middleware #2 public override async Task Invoke

Facebook Login recommending to require HTTPS - How to Configure HTTP redirect URL for Facebook Login in ASP.NET MVC?

徘徊边缘 提交于 2020-01-02 03:52:04
问题 Facebook is recommending that I use a HTTPS redirect URL, instead of HTTP. I've been trying to find a way to configure it to generate a HTTPS URL, at the moment it's generating a HTTP URL. https://www.facebook.com/v2.8/dialog/oauth?response_type=code&client_id=255162614498922&redirect_uri= http://example.com/signin-facebook &scope=&state=-x4AVtFysadfadsfsadROH6E1QJ82gv4e4j48s32K5xbmqlF-JFbE5Y2Tx

How to setup a custom authentication on asp.net mvc identity?

笑着哭i 提交于 2020-01-02 03:42:05
问题 What I Need?! I have an ASP.NET identity system setup and running with external logins. For whatever reason i need to setup a custom authentication after the ASP.NET identity authentication. Let me explain how? Lets say I have three pages for the users to view on my application, Page A,B,C. Who can view Page A? Any anonymous user can view page A. Who can view Page A & B? Any user who have created an account either with his/her email & password or with external logins. Who can view Page A,B &

Web Api 2 HttpContext or HttpActionContext

牧云@^-^@ 提交于 2020-01-02 02:32:06
问题 What is the difference between the following two ways of accessing the principle via an AuthorizeAttribute implementation? Using HttpContext : protected override bool IsAuthorized(HttpActionContext actionContext) { return HttpContext.Current.User.IsInRole("DemoRole"); } Using HttpActionContext : protected override bool IsAuthorized(HttpActionContext actionContext) { return actionContext.RequestContext.Principal.IsInRole("DemoRole"); } 来源: https://stackoverflow.com/questions/28235979/web-api-2

Facebook PopUp Login with Owin

馋奶兔 提交于 2020-01-01 19:13:17
问题 I'm using MVC with Owin external login with Facebook. Owin doesn't open facebook login as popup.It redirects the page to facebook. I know there is a option to make facebook login open as popup.We need to add the "&dialog=popup" in the URL. I don't have this option with OWIN. Is there any way to do that? 回答1: I had the same problem. After reading though the source, I found a solution: Basically: you need to go ahead and create an authentication provider for Facebook. So create a class that

Can OWIN replace DI in a ASP.NET MVC application?

為{幸葍}努か 提交于 2020-01-01 13:15:15
问题 About a year ago, the automatically generated MVC project upon creation in Visual Studio included nothing about OWIN. As someone who is making an application again, trying to understand the changes, I'd like to know if OWIN can replace my DI. From what I understand, this following bit from Startup.Auth.cs is what centralizes the creation of the user manager (to handle identities), as well as the creation of the database connection for the application. public partial class Startup { // For

OWIN OpenID connect authorization fails to authorize secured controller / actions

我们两清 提交于 2020-01-01 08:47:09
问题 I am working on a project where a third party provider will act as an Oauth2 based Authorization Server. An Asp.net MVC 5 based client which will send the user to the authorization server to authenticate (using login / password) and the auth server will return an access token back to the MVC client. Any further calls to resource servers (APIs) will be made using the access token. To achieve this I am using Microsoft.Owin.Security.OpenIdConnect and the UseOpenIdConnectAuthentication extension.