asp.net-identity

asp.net mvc 5 entity framework 6 identity working with trust level = medium?

牧云@^-^@ 提交于 2019-12-02 09:41:45
Creating the simplest project (In visual studio 2013 -> asp.net web application -> MVC authentication with individual accounts), it works perfectly on localhost. However, when sending to the server (medium trust level), the project does not work when I try to enter login. See the error image: http://s18.postimg.org/fm2qw8gzt/print.png I tried to include on assembly.cs [assembly: AllowPartiallyTrustedCallers]. It did not work. I have created a strong name key. It did not work. The server does not support level = full trust. Do not believe there need to be full, because few asp.net mvc 5 sites

Get custom claims from a JWT using Owin

僤鯓⒐⒋嵵緔 提交于 2019-12-02 09:32:21
I'm using Owin with JWTBearerAuthentication to authorize users and validate their tokens. I'm doing it like this: public class Startup { public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); ConfigureOAuth(app); app.UseWebApi(config); } private void ConfigureOAuth(IAppBuilder app) { string issuer = ConfigurationManager.AppSettings.Get("auth_issuer"); string audience =

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

佐手、 提交于 2019-12-02 09:28:14
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 trivial connection between the two. Can someone throw some light at whet I am missing. The following is the

ASP Identity table column change but mapping is not possible with new column name

被刻印的时光 ゝ 提交于 2019-12-02 08:20:57
问题 I have changed the asp Identity so that in database Id column of AspNetIdentity table be UserId : modelBuilder.Entity<ApplicationUser>() .Property(p => p.Id) .HasColumnName("UserId"); And that works fine. Generated table have UserId instead Id . Now I have another table that should be mapped with AspNetUsers by UserId : When write it this way: public class JobApply { ... public int UserId { get; set; } public virtual ApplicationUser ApplicationUser { get; set; } Table in database looks like:

Using multiple ASP Identity 2.0 within ASP.Net MVC 5 application

谁说我不能喝 提交于 2019-12-02 08:02:47
问题 I have a web application with admin area for managing content but the rest of the site is currently secured by ASP Identity that authenticates my public users. Now I need to authenticate some internal users to access the admin area. Is this possible? 回答1: What you are looking for is known as SSO (Single Sign On). With SSO a user can login once and access multiple applications. There are great articles on the web about the implementation. Have a look at http://arunendapally.com/post

Configuring Identity Server to use ASP.NET Identity roles

只愿长相守 提交于 2019-12-02 07:55:59
问题 I am trying to learn more about Identity Server. I am currently struggling to get Role Based Authorisation working. Here are the steps I have followed: 1) Download the sample solution: https://github.com/IdentityServer/IdentityServer4.Samples/tree/release/Quickstarts/6_AspNetIdentity 2) Run the solution, which starts: a) Identity Server project b) MVC project c) API project 3) Browse to the MVC project and apply migrations. 4) Register a new user: Bert@Bert.com 5) Browse to:

Identity 2.0 Code First Table Renaming

*爱你&永不变心* 提交于 2019-12-02 07:19:58
问题 I'm trying to rename the identity tables to Roles, Users, UserRoles, UserLogins and UserClaims. I partially succeeded doing and using the command Update-Table updates my database. However I cant seem to be able to get rid off the AspNetUsers table, it always gets generated with only one column, the Id column, although I get another Users table with the full list of columns, and another Id column. The script generated by Update-Database Applying automatic migration: 201501190035078

How to link one-to-one relationship when fk is different from pk - EntityFramework

六月ゝ 毕业季﹏ 提交于 2019-12-02 07:16:29
I have a custom users table in my database and i want to create a one-to-one relationship with aspnetusers table so that when i register a new customer, applicationuser class through UserManager should add the username, email, password and school code to the users table and add an fk in its own table. IS there any tutorial/example implementing this kind of scenario? I am trying to add a one-to-one relationship with my users table but the fk is different than pk Users Table [columns] username password school code userId [pk] ASPNETUsers Table [standard columns] Id, [pk] UserName, PasswordHash,

Using multiple ASP Identity 2.0 within ASP.Net MVC 5 application

那年仲夏 提交于 2019-12-02 06:40:51
I have a web application with admin area for managing content but the rest of the site is currently secured by ASP Identity that authenticates my public users. Now I need to authenticate some internal users to access the admin area. Is this possible? What you are looking for is known as SSO (Single Sign On). With SSO a user can login once and access multiple applications. There are great articles on the web about the implementation. Have a look at http://arunendapally.com/post/implementation-of-single-sign-on-(sso)-in-asp.net-mvc for a sample. 来源: https://stackoverflow.com/questions/28802168

How to correctly implement other entity's reference to Identity user?

时光毁灭记忆、已成空白 提交于 2019-12-02 06:34:32
问题 I'm using Identity which has his own context. public class ApplicationUser : IdentityUser { // some custom fields } public class IdentityContext : IdentityDbContext<ApplicationUser> { //... } Also I have some other entities like this public class Comment{ public int Id {get;set;} public string Message{get;set;} public DateTime Time{get;set;} } which are used by my other context public class MyContext :DbContext { public DbSet<Comment> Comments { get; set; } //... other DbSets } Question. I