asp.net-identity

Handling server redirect to Facebook login page in AngularJS

陌路散爱 提交于 2019-12-10 22:09:46
问题 I have an AngularJS app, and a WebApi2 with ASP.NET Identity 2.0. I am trying to log user in using Facebook account. I am using this answer to do it. Getting auth providers is easy, I have problem with the next step. It says, I should make GET request to my WebApi server, using the Url provided before. So I make my call and get a HTTP 302 with Location header set to facebook's login page. The browser doesn't redirect, however. In Developer Tools I see that GET request to this address is made,

MVC 5 current claims autorization and updating claims

旧时模样 提交于 2019-12-10 21:44:19
问题 I have 2 questions regarding the claims: 1) In .Net 4.5 and MVC 5 how does the microsoft implements the autorization, when you set on controller AuthorizeAttirubte, does it check the database to get the user role? Or it uses the claims? I've read somewhere that microsoft uses database each time to verify the role, and they advised to write a new AuthorizeAttribute to implement claims authentication. This is the article i'm talking about: http://kevin-junghans.blogspot.be/2013/10/improving

Correct way of setting the role for user when he is registered with Identity

人走茶凉 提交于 2019-12-10 21:35:16
问题 I have a question, I'm new to identity, but still i would like to know what would be the correct way of assigning role to a user when he is registering? I have here a code: [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser() { UserName = model.UserName }; RoleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext()));

ASP.NET Identity 2.1 change PK to int error

杀马特。学长 韩版系。学妹 提交于 2019-12-10 21:14:29
问题 I have changed the PK as described in http://www.asp.net/identity/overview/extensibility/change-primary-key-for-users-in-aspnet-identity, however after I try to login, i get the following error. The login part is successful because "this" contains all the approperate data, however creating identity seems to fail The specified cast from a materialized 'System.String' type to the 'System.Int32' type is not valid. at the line var userIdentity = await manager.CreateIdentityAsync(this,

How am I getting a windows identity in this code?

牧云@^-^@ 提交于 2019-12-10 21:09:35
问题 Related to this problem: Owin Stage Markers I'm using owin and identity framework to init an IIS hosted web app with authentication ... public static void Configure(IAppBuilder app, IKernel kernel) { // ensure that owin creates the required UserManager & sign in manager per owin instance app.CreatePerOwinContext<ApplicationUserManager>((options, owinContext) => ApplicationUserManager.Create(options, owinContext, kernel)); app.CreatePerOwinContext<ApplicationSignInManager>((options,

ASP.NET Identity cookie and subdomains

女生的网名这么多〃 提交于 2019-12-10 20:46:01
问题 I'm trying to share my ASP.NET Identity cookie across subdomains. Currently just locally. sub1.domain.local sub2.domain.local I have the same machine key on both sites, but a cookie created on sub1 does not validate on sub2 and vice versa. The resulting cookie domain is always ".domain.local" (which should be correct??) This is my setup in Startup class: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath =

Appending 'hd' parameter to redirectUrl ASP.NET Core 1 with Identity 3

对着背影说爱祢 提交于 2019-12-10 20:02:03
问题 In ASP.NET 4 with the Identity Framework 2 I can append the redirectUri with a parameter of my own, like the 'hd' parameter Google uses to limit login to a domain like this: var googleAuthOptions = new GoogleOAuth2AuthenticationOptions { ClientId = "redacted", ClientSecret = "redacted", Provider = new CustomGoogleProvider { OnApplyRedirect = context => { var redirect = context.RedirectUri; redirect += "&hd=contoso.com"; context.Response.Redirect(redirect); } } }; app.UseGoogleAuthentication

How to trigger login for IdentityServer4 without accessing secure page in the MVC app?

早过忘川 提交于 2019-12-10 19:45:27
问题 In the docs http://docs.identityserver.io/en/release/quickstarts/3_interactive_login.html it says " Trigger the authentication handshake by navigating to the protected controller action ". This would be by simply accessing any action in your MVC site with [Authorize]. After signin, this would redirect to the page they were trying to access, not to the page they last visited (which is good, expected behavior). Great. But what about this scenario? User is in some anonymous part of the site.

Dependency Injected UserManager is disposing on async call (ASP.NET CORE)

拜拜、爱过 提交于 2019-12-10 19:45:25
问题 I am using ASP.NET Core with its inbuilt dependency injection and asp.net identity. The problem I am having is whenever I try and access any of the context's via async (ie in this example UserManager<ApplicationUser> ) it is being disposed when accessing. For example, my controller is below (The object we are concerned with is UserManager ) private readonly ApplicationDbContext _dbContext; private readonly UserManager<ApplicationUser> _userManager; private readonly ViewRender _view; private

Asp.Net MVC 5 Identity Create Database Admin Interface

℡╲_俬逩灬. 提交于 2019-12-10 19:20:00
问题 I'm working on a new asp.net mvc 5 app for a small company and am trying to figure out how to create the membership database using the new asp.net Identity system. I thought there might be an admin interface I can use which would create the database and allow me to add a few users/roles. Is there an admin interface for this task or another way I will need to accomplish it? Are there any tutorials on doing something like this? All I have been able to find so far has dealt with external logins