Hello,
I added to custom claims to the CreateProperties metadata of the MembershipRebootIdentityManagerService by the use of a custom metadataFunc.
I wanted to set Name, Phone and other custom claims, mandatory on the create and update...
However an error occurred when creating the user, because of the function CreateUserAsync on the MembershipRebootIdentityManagerService class.
The following code block (lines 288 to 291):
foreach (var prop in otherProperties)
{
SetUserProperty(createProps, acct, prop.Type, prop.Value);
}
The SetUserProperty fails when the property is a claim and not a field of the user account.
It implies that the account is already created, when before adding it invokes : UserAccountService.RemoveClaim.
it does the following
var account = base.GetByID(accountID);
if (account == null) throw new ArgumentException("Invalid AccountID", "accountID");
Which threw the error since the this.userAccountService.CreateAccount happens after.
The change i did, to do the otherproperties after the account is created on the repository.
It is not perfect, since it should on do so, for the claims, and not for example, Phone.. However, since they are not mandatory, this was a quick fix.