asp.net-identity

Use External Access Token or Local Access Token

左心房为你撑大大i 提交于 2019-12-02 21:11:32
I am developing an application using ASP.NET MVC 5.2.2, Web API 2.2 and Katana/OWIN 3.0 . The application uses ASP.NET Identity 2.1 for local accounts and database. I am using OAuth Authorization Server to generate access and refresh token. I have Android and IOS apps which uses my local oauth authorization server. Android and IOS apps uses SDK to login with Facebook, Google, etc. After that the apps will send the (Facebook/Google/etc) access token to the server. The server will validate access token with Facebook/Google/etc. If it is valid then, 1) Should I generate new local access token(in

ASP.NET Identity

烂漫一生 提交于 2019-12-02 20:36:58
I'm currently building a new ASP.NET MVC 5 project which I want to release around September. I need to choose a membership system, but I'm currently quite confused about which direction should I take. The current SimpleMembership works well, but will apparently be incompatible with the upcoming ASP.NET Identity. ASP.NET Identity on the other hand is absolutely new with zero documentation and can change anytime. Finally it seems that string based IDs are used here, which seems like a very unnecessary overhead compared to integer based IDs, which SimpleMembership supports. Is there a good,

Supporting Individual User Accounts AND Organizational Accounts in MVC5 / ASP.Net Identity 2

℡╲_俬逩灬. 提交于 2019-12-02 19:28:49
I've created an ASP.Net MVC5 application, in which I have configured (and have working fine) Individual User Accounts via Google, Facebook, etc. What I'd like to do is also support authentication against Azure Active Directory (Organizational Accounts). This would be for internal staff to be able to logon to the app as administrators. All existing information/guides/documentation I've found typically deals with using one or the other. How would I enable them both together? If there needs to be a separate logon form for each type of user, that would not be an issue. EDIT: I was looking at the

ASP.NET Core - Add role claim to User

╄→гoц情女王★ 提交于 2019-12-02 18:35:16
I've an ASP.NET Core (based on .NET Framework) using Windows Authentication. Point is, I need to add a role claim on that user and this role is stored in a distant database. I've read so much thing about OWIN/Cookie/UserManager/UserStore/Identity and so on that I'm lost. Question : How do I add a role claim for current user logged in (windows) for the whole application in the easiest way? What I need is to easily use [Authorize(Role= "MyAddedRole")] or bool res = User.IsInRole("MyAddedRole") Thanks Answering myself, so what I did : Create my own UserClaimStore (I only need this store, not the

ASP.NET Identity remove column from AspNetUsers table

為{幸葍}努か 提交于 2019-12-02 18:28:32
When I use ASP.NET Identity first code approach, I want to generate columns in AspNetUsers table in my own way. I don't need to have stored multiple columns with null values. I just need columns Id, SecurityStamp and UserName. Only post, that I've found is here: AspNet Identity 2.0 Email and UserName duplication , but it is still unsloved (due to error in Santosh comment). So can anybody tell my how to solve this? EDIT: Is it even possible to delete some of these columns/properties? Thanks The short answer is no, not without rolling your own implementation. Or you can wait for them to open

Code First & Identity with Azure Table Storage

断了今生、忘了曾经 提交于 2019-12-02 18:11:12
I'm working on a small web app and I've just hit the point in development where I need to start making database decisions. My original plan was to go EF Code First with MSSQL on Azure because it just simplifies the process of working with a database. However, when investigating my database hosting capabilities on Azure, I discovered Azure Table Storage which opened up the world of NoSQL to me. While the Internet is ablaze with chatter about the features of NoSQL, one of the biggest reason I have managed to gather is that NoSQL stores entire objects as one in a database without breaking up the

What is this line of code ViewBag.RoleId = new SelectList(RoleManager.Roles, “Id”, “Name”)

给你一囗甜甜゛ 提交于 2019-12-02 17:45:50
问题 I find in a code example downloaded the following line of code in an Action method of a controller. ViewBag.RoleId = new SelectList(RoleManager.Roles, "Id", "Name") or probably its async version ViewBag.RoleId = new SelectList(await RoleManager.Roles.ToListAsync(), "Id", "Name"); I am not able to fathom whats happening here. Also in the corresponding view, I nowhere see ViewBag.RoleId being used. Instead I find in the view @Html.DropDownList("RoleId","No Roles") There appears to be some

Using ASP.Net Identity in MVC 4

拜拜、爱过 提交于 2019-12-02 17:42:14
I've been reading about the new auth stuff in the upcoming versions of ASP.net: http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx I'm creating a new ASP.net MVC 4 project in visual studio 2012 and I'd like to use the new auth bits if I can. Is this possible? I'm reading code and trying to wrap my head around this new API. But in the meantime, what steps are involved to get going? It should be doable, first you basically want to install the 3 packages: Microsoft.AspNet.Identity.Core Microsoft.AspNet.Identity

MVC 5 Identity Automatic Logout

自闭症网瘾萝莉.ら 提交于 2019-12-02 17:32:11
How do I implement an Automatic Logout Timer. So basically if the user is inactive for x minutes their session is ended? I have tried: <system.web> <sessionState timeout="1"/> </system.web> But it doesn't seem to work. Here is code that is in my startup: public void ConfigureAuth(IAppBuilder app) { // Enable the application to use a cookie to store information for the signed in user app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login") }); } Which says that I am using cookie

Get list of users with assigned roles in asp.net identity 2.0

眉间皱痕 提交于 2019-12-02 17:07:26
I have a drop down list box which lists roles. I want to get the list of users having that role. I mean list of users that are in "Administrator" role or "CanEdit" role. Here is my code: public IQueryable<Microsoft.AspNet.Identity.EntityFramework.IdentityUser> GetRolesToUsers([Control] string ddlRole) { //ddlRole returns role Id, based on this Id I want to list users var _db = new ApplicationDbContext(); IQueryable<Microsoft.AspNet.Identity.EntityFramework.IdentityUser> query = _db.Users; if (ddlRole != null) { //query = query.Where(e => e.Claims == ddlRole.Value); ??????? } return query; }