Closed NigeB closed 7 years ago
Give it a try :)
Ok, so I thought that would be easy enough...
I created a CustomUserClaim type with the new property values:
public class CustomUserClaim {
public CustomUserClaim() {}
public CustomUserClaim(string type, string value) {
this.Type = type;
this.Value = value;
}
[Required]
[StringLength(150)]
public string Type { get; protected internal set; }
[Required]
[StringLength(255)]
public string Value { get; protected internal set; }
}
Then created a CustomRelationalUserClaim derived from the CustomUserClaim:
public class CustomRelationalUserClaim<TKey> : CustomUserClaim {
public virtual TKey Key { get; set; }
public virtual TKey ParentKey { get; set; }
}
public class CustomRelationalUserClaim : CustomRelationalUserClaim<int> { }
Then created a CustomRelationalUserAccount derived from RelationalUserAccount to take a CustomRelationalUserClaim type parameter:
public class CustomRelationalUserAccount<TKey, TCustomRelationalUserClaim, TRelationalLinkedAccount, TRelationalLinkedAccountClaim, TRelationalPasswordResetSecret, TRelationalTwoFactorAuthToken, TRelationalUserCertificate> : RelationalUserAccount {
public CustomRelationalUserAccount() : base() { }
}
Then derived my CustomUser class from CustomRelationalUserAccount instead of RelationalUserAccount.
Finally overriding AddClaim() in CustomUserAccountService to use the new CustomUserClaim type, which doesn't seem to work anyway.
All of which suggests to me I must be going horribly wrong and that this is really a two liner change that I'm not seeing.
Could you possibly point me in the right direction please Brock?
OK, so I cheated - after battling with that on and off, I just downloaded the source and changed the model :-)
Would still be interested in the more appropriate tho!
Leave this open so I remember to come back to it when I have some time...
Having this increased would be very helpful.
Just wanted to vote on this, as I'm running into this issue as well, and would also appreciate the ability to have claims >150 characters. I too don't see an obvious way to easily increase the lengths without overriding a bunch of stuff I'd rather not touch (although I could be missing something).
As a quick workaround, I disabled EF validation completely, and manually altered the SQL schema. Not ideal, but it works.
Given that I don't foresee making this change, I'll close this issue. Thanks.
Hi Brock.
I've just run into an issue with storing the address claim as a json object. - the schema for MR has the Value of the user claims as NChar(150), which is too short.
Is there any particular reason it's 150?
Am I going to mess anything up by increasing it?
Thanks.