asp.net-identity

ASP.net identity - external login - won't log out

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 06:23:07
问题 In my application, all my authentication happens with Google - ie - all my users are Google Accounts. I don't need users to need to register in my app, just sign in using a Google account. However, I do want to manage Roles for the users with ASP.net Identity ( I think ) With that in mind, on successful external authentication, I create an ASP.net Identity user (if one doesn't exist) So, I've got my ExternalLoginCallback as follows: [AllowAnonymous] public async Task<ActionResult>

Changing password asp.net identity

橙三吉。 提交于 2019-12-02 04:37:30
Is there a quick way to verify is user exists and based on existence of user name get user id? (i.e. the user only has the user name and the adds it to change their password)? I would think something like this... String userId = User.Identity.GetUserId(userName); I am looking for a quick way for local users to change their password if need be. User.Identity.GetUserId() will return the id of current logged in user. From UserManager you can get any user from their username like this var user = UserManager.FindByName("the username here"); then you can change password from UserManager again

Could not load type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider

ぃ、小莉子 提交于 2019-12-02 03:59:21
I recently tried to implement authentication using asp.net identity with 4.6.1 framework. After installing all the required packages I am getting the following error when running the application. "Could not load type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider" The same application works fine when all the packages related to identity are uninstalled. Full stack trace is as follows [TypeLoadException: Could not load type 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ITypeRegistrationsProvider' from assembly

Configuring Identity Server to use ASP.NET Identity roles

淺唱寂寞╮ 提交于 2019-12-02 03:26:41
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: CallApiUsingUserAccessToken in the MVC project. The API is reached as expected because the user is authorised. Say I now

How to remove the role-related tables from ASP.NET Identity Core 2.0

匆匆过客 提交于 2019-12-02 03:10:18
With the advice read-elsewhere that Roles are a subset of Claims, I am looking at a clean way to ask the EF Core implementation in ASP.NET Identity not to create role-related tables in the ASP.NET Identity Core 2.0 template in VS 2017. Only claims are needed. The template uses public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); // Customize the ASP.NET Identity model and override the

Asp.net Identity Email Verifcation Token Not Recognized

点点圈 提交于 2019-12-02 02:41:32
We are using Microsoft's Identity Framework v2.0 in a web forms application. All is working well. We decided we want to add email verification as part of the new account set up process. If we validate the token after it is created in the same page, we are successful. But if we try to validate the token in a different page, it fails. The process is very simple: Admin creates a new account by providing user's email and name. (we do not support self registration). User clicks link he gets in email to validate the email was received. Here is the code to create the email verification token: var

Asp.net Identity Email Verifcation Token Not Recognized

橙三吉。 提交于 2019-12-02 02:29:00
问题 We are using Microsoft's Identity Framework v2.0 in a web forms application. All is working well. We decided we want to add email verification as part of the new account set up process. If we validate the token after it is created in the same page, we are successful. But if we try to validate the token in a different page, it fails. The process is very simple: Admin creates a new account by providing user's email and name. (we do not support self registration). User clicks link he gets in

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

半腔热情 提交于 2019-12-02 02:12:47
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 want that my Comment entity had author property, so I'll have something like public class Comment{ public

Session logged out too soon

会有一股神秘感。 提交于 2019-12-02 00:56:46
问题 I'm using ASP.NET Core 2.1 with Microsoft Identity and users are complaining that they keep getting redirected to the login screen after only around 30 minutes of inactivity. I've set it up with 60 minutes in the ExpireTimeSpan, but it's never lasting anywhere near that long. Any suggestions? This is what I have in the Startup.cs file: public void ConfigureServices(IServiceCollection services) { services.AddScoped<IRFDbRepository, RFDbRepository>(); var connection = _configuration

ASP.net identity - external login - won't log out

为君一笑 提交于 2019-12-02 00:54:18
In my application, all my authentication happens with Google - ie - all my users are Google Accounts. I don't need users to need to register in my app, just sign in using a Google account. However, I do want to manage Roles for the users with ASP.net Identity ( I think ) With that in mind, on successful external authentication, I create an ASP.net Identity user (if one doesn't exist) So, I've got my ExternalLoginCallback as follows: [AllowAnonymous] public async Task<ActionResult> ExternalLoginCallback(string returnUrl) { var authenticationManager = Request.GetOwinContext().Authentication; var