IdentityManager / IdentityManager.AspNetIdentity

ASP.NET Identity support for Thinktecture IdentityManager
Apache License 2.0
60 stars 51 forks source link

Empty GUIDs in subject when creating new users #13

Closed moody19871987 closed 9 years ago

moody19871987 commented 9 years ago

Hi. I use a combination of IdSrv + IdSrv.AspNetIdentity + IdManager + IdManager.AspNetIdentity and I encountered an issue with creating new users from IdentityManager UI.

I use AspNet.Identity users with GUIDs as Ids. When I create a new user, his subject is always set to empty Guid, so I can't create any more users this way.

brockallen commented 9 years ago

Can you debug into it a bit to help me determine what might be the issue?

brockallen commented 9 years ago

In the IdentityUser base class, it sets the ID to a new guid. The subject in IdentityManager for ASP.NET Identity is just that ID. Not sure why yours is getting an empty guid.

brockallen commented 9 years ago

Any updates?

moody19871987 commented 9 years ago

I'm sorry for the delay. I know that this issue has been already closed but I would like to share my solution/work around of the problem. Actually this problem is not strictly related to Identity Manager itself, but rather to Microsoft AspNet Identity.

While creating a new user in IdentityManager's UI the collected form values (username and password) are passed to the AspNetIdentityManagerService (delivered with IdentityManager.AspNetIdentity) and then inside of the CreateUserAsync method a new user class is created with its parameterless constructor.

I use my own user class which derives from IdentityUser<TKey, TLogin, TRole, TClaim> from Microsoft.AspNet.Identity.EntityFramework nuget package. Everything that I had to do was to generate a new GUID for user's id in the parameterless constructor of my user class.