asp.net-identity

'AllowAnonymous' could not be found

我是研究僧i 提交于 2019-12-10 15:47:23
问题 Everything worked fine until I installed (Package Manager Console) the postal package, then uninstalled and installed an older version. Now I get an error where it previously was not. Error: The type or namespace name 'AllowAnonymous' could not be found (are you missing a using directive or an assembly reference?) Who knows how to fix this? 回答1: Probably you are missing the reference to System.Web.Http assembly in your project? So you need to: Add the reference to System.Web.Http ; Add using

ASP.NET Identity Manager Error: error when trying to create a controller of type 'MetaController' (no parameterless public constructor)

若如初见. 提交于 2019-12-10 15:15:21
问题 I got ThinkTecture's IdentityManager running, but now when going to the '/idm/ url I get an error: An error occurred when trying to create a controller of type 'MetaController'. Make sure that the controller has a parameterless public constructor. The error was mentioned in a comment in another StackOverflow issue but a solution to this issue was not given. 回答1: While formulating this question I also found the solution in an issue of the IdentityManager GitHub repo. I had to change the

IUserStore<TUser>.CreateAsync : how to indicate failure in custom implementation?

我是研究僧i 提交于 2019-12-10 15:07:35
问题 I am writing a custom implementation for IUserStore. The signature of the create method is: public async virtual Task CreateAsync(TUser user) And that makes sense considering the core interface IUserStore in Microsoft.AspNet.Identity is (which is the same). However the interface of the UserManager class defined in Microsoft.AspNet.Identity is : public virtual Task<IdentityResult> CreateAsync(TUser user); My problem is I don't see how I should pass this IdentityResult to the UserManager since

How do I configure the Users context/table?

大憨熊 提交于 2019-12-10 14:46:02
问题 With the new ASP.NET MVC 5 Preview released, how do I configure the Users context/table? In MVC 4 I would just use my own User class and then point the WebSecurity initialize to it, tike this: WebSecurity.InitializeDatabaseConnection(connectionString, "System.Data.SqlClient", userTableName, userIdColumn, userNameColumn, autoCreateTables); I wish to add additional properties to the Users class - how? 回答1: The UserStore and User classes are there to make EF based implementations easier, but you

How to set the cookie validateInterval in ASP.NET Core?

旧街凉风 提交于 2019-12-10 14:45:33
问题 I'm trying to set the validateInterval for an ASP.NET 5 RC1 application which makes use of ASP.NET Identity 3 I am trying to implement the code in this answer. there are many code sample like this answer but it seems it isn't valid in ASP.NET 5 RC1 app.UseCookieAuthentication(new CookieAuthenticationOptions { Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan

Web API 2 and ASP Identity - Handling of locked out users

我是研究僧i 提交于 2019-12-10 13:47:47
问题 I just migrated my web app (ASP.NET MVC) to ASP Identity. Everything works fine after quite some work, except the API which the web app provides. This is a WEB API 2, and it is using the bearer token mechanism to authenticate users. The authentication itself also works fine. but: When a user is locked out, the token for the user is still issued via the API-token-endpoint. Is there a suggested way to handle this? I did not find any example... Thanks! 回答1: Ok, that was a stupid one... I see

Identity 2.0 Claims not being added to the database

僤鯓⒐⒋嵵緔 提交于 2019-12-10 13:42:07
问题 I'm using MVC5 with the latest version of Identity (2.1) I'm trying to create a user claim for the facebook access_token. I've never created a claim before, but my other Identity functionality works fine as far as I can tell. I have this line of code in my Startup.Auth.cs: context.Identity.AddClaim(new Claim("urn:facebook:access_token", context.AccessToken, xmlSchemaString, "Facebook")); The full piece of code is here if you need more reference: Integrate facebooksdk with Identity 2.0 If I

Having separate projects in one ASP.NET MVC 5 solution

痴心易碎 提交于 2019-12-10 13:20:17
问题 I want to have many projects(like 20) in one ASP.NET solution. All projects would have their own databases, models, views and controllers. Can you tell me how I can do that? And how the urls would be? If there is one project in the solution it is like this : localhost:12345/Controller/View When there are more projects, would the correct configuration like this ? : localhost:12345/ProjectName/Controller/View One more thing, I am planning to use Identity 2.0 Framework. Is it possible for a user

Cannot logoff of identity MVC 5 application

天涯浪子 提交于 2019-12-10 13:19:55
问题 I'm making a new (empty template) ASP.NET MVC 5 application and I cannot logoff of this app. My logoff Action: public ActionResult LogOff() { if (User.Identity.IsAuthenticated) { //break here } try { AuthenticationManager.SignOut(); if (User.Identity.IsAuthenticated || Request.IsAuthenticated) { //break here; } } return RedirectToAction("Login", "Account"); } Startup class: public partial class Startup { public void ConfigureAuth(IAppBuilder app) { app.UseCookieAuthentication(new

Prevent users without confirmed email from logging in ASP.NET MVC Web API Identity (OWIN Security)

帅比萌擦擦* 提交于 2019-12-10 13:08:03
问题 I have a MVC and a web API projects, authenticated using ASP.NET MVC Web API Identity (OWIN Security). I added an email confirmation to the Register function that works properly but I'm not sure how to check if emailConfirmed = true before logging in because there is no an explicit Login function on Web API Identity, it's implicit . I know Microsoft has a good reason to deeply encapsulate the authorization functionality, but isn't there a way to achieve that? Please advise. This is my