owin

MVC5 OWIN ws-federation AuthenticationManager.GetExternalLoginInfoAsync() returns null

房东的猫 提交于 2020-01-24 04:37:46
问题 I'm trying to setup integrated OWIN WS-Federation (ADFS) authentication in a new MVC 5 project in Visual Studio 2013. WsFederation in Startup.Auth is configured as follows: app.UseWsFederationAuthentication(wtrealm: "MyRealm", metadataAddress: "https://myADFSInstanceHost/FederationMetadata/2007-06/FederationMetadata.xml"); Federation button at login page works fine. ADFS login page is achievable, i can log in there. Required cookies seems to being set properly. At least there is passed

MVC5 OWIN ws-federation AuthenticationManager.GetExternalLoginInfoAsync() returns null

社会主义新天地 提交于 2020-01-24 04:37:11
问题 I'm trying to setup integrated OWIN WS-Federation (ADFS) authentication in a new MVC 5 project in Visual Studio 2013. WsFederation in Startup.Auth is configured as follows: app.UseWsFederationAuthentication(wtrealm: "MyRealm", metadataAddress: "https://myADFSInstanceHost/FederationMetadata/2007-06/FederationMetadata.xml"); Federation button at login page works fine. ADFS login page is achievable, i can log in there. Required cookies seems to being set properly. At least there is passed

Inject IOwinContext with Web API and Ninject

萝らか妹 提交于 2020-01-23 05:48:08
问题 Using Web API 2 and OWIN hosting with Ninject. I would like to inject the current IOwinContext into certain services (so I can get at the Request to get the principal to do some data filtering). With Web Hosting I would, in the old days, simply have used HttpContext.Current but that is not an option with OWIN hosting (and good riddance). This SO question explains how to do it with Autofac. Essentially, you create a Dependency Scope and then, on each request, calls Autofac's Registerinstance

Owin Authentication In MVC and Web Api

谁都会走 提交于 2020-01-23 02:05:28
问题 I'm trying to use the same authentication between the MVC controllers and the Web Api controllers. The Web api is in the same project, just in an /Controllers/API/ folder. I can't seem to figure out how to authenticate using OWIN, when I logged in through MVC and created a claim and a cookie like the example below. var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name,"Admin"), new Claim(ClaimTypes.Role,"Administrator") , "ApplicationCookie"); var ctx = Request.GetOwinContext();

Owin Authentication In MVC and Web Api

血红的双手。 提交于 2020-01-23 02:05:27
问题 I'm trying to use the same authentication between the MVC controllers and the Web Api controllers. The Web api is in the same project, just in an /Controllers/API/ folder. I can't seem to figure out how to authenticate using OWIN, when I logged in through MVC and created a claim and a cookie like the example below. var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name,"Admin"), new Claim(ClaimTypes.Role,"Administrator") , "ApplicationCookie"); var ctx = Request.GetOwinContext();

UserCookieAuthentication in Mono 3.4.1

安稳与你 提交于 2020-01-22 09:51:05
问题 When ever I add the line below to my Startup class I get the exception below. This is a self hosted exe running from mono (Ubuntu). It works fine in windows. I've narrowed it down the UseCookieAuthentication call. I can instantiate the options without any issue. Any idea what is going on here? I have aspnet Identity working and EF6/MySql. app.UseCookieAuthentication(new CookieAuthenticationOptions()); Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown

OWIN/OAuth2 3rd party login: Authentication from Client App, Authorization from Web API

牧云@^-^@ 提交于 2020-01-20 21:46:21
问题 I am trying to create a Web API that allows the API's clients (native mobile apps) to login using a 3rd party cloud storage provider. I'm using the following general flow from Microsoft: Here is what I am trying to achieve: I am using the default ASP.NET Web API Visual Studio template with external authentication, along with the OWin.Security.Providers Nuget package for Dropbox login functionality, and the existing built-in login functionality for Google (Drive) and Microsoft (OneDrive). The

OWIN/OAuth2 3rd party login: Authentication from Client App, Authorization from Web API

你。 提交于 2020-01-20 21:46:11
问题 I am trying to create a Web API that allows the API's clients (native mobile apps) to login using a 3rd party cloud storage provider. I'm using the following general flow from Microsoft: Here is what I am trying to achieve: I am using the default ASP.NET Web API Visual Studio template with external authentication, along with the OWin.Security.Providers Nuget package for Dropbox login functionality, and the existing built-in login functionality for Google (Drive) and Microsoft (OneDrive). The

Owin Bearer Token Authentication + Authorize controller

☆樱花仙子☆ 提交于 2020-01-20 16:42:05
问题 I'm trying to do authentication with Bearer tokens and owin. I can issue the token fine using the grant type password and overriding GrantResourceOwnerCredentials in AuthorizationServerProvider.cs . But I can't reach a controller method with the Authorize attribute. Here's my code: Startup.cs public class Startup { public static OAuthAuthorizationServerOptions OAuthOptions { get; private set; } // normal public Startup() : this(false) { } // testing public Startup(bool isDev) { // add

Setup OWIN dynamically (by domain)

做~自己de王妃 提交于 2020-01-20 04:57:25
问题 We are trying to setup a white label on our project that uses OWIN(includes FB, google, Live logins). Is there a way to setup their API credential dynamically, say if they changes the domain the settings will change. I think owin loads earlier than MVC? Is there a way that we can load it on Global.asax(Request)? public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } UPDATE: In other words a single Application will host many domains and sub domains