grandchamp / Identity.Dapper

Identity package that uses Dapper instead EntityFramework for use with .NET Core
MIT License
268 stars 62 forks source link

Claim definition #75

Open kliszaq opened 6 years ago

kliszaq commented 6 years ago

Hi guys nice work. I have found one inconsistency regarding the claim objects. In the System.Security.Claims there is a constructor you are using:

// // Summary: // Initializes a new instance of the System.Security.Claims.Claim class with the // specified claim type, and value. // // Parameters: // type: // The claim type. // // value: // The claim value. // // Exceptions: // T:System.ArgumentNullException: // type or value is null. public Claim(string type, string value);

As you can see if one of the input values is null then an exception is thrown. In the MSSQL defintion for the table IdentityUserClaim the value is NULL, and therefore unaware dev will get the exception being thrown as soon as he tries to sign in:

CREATE TABLE [IdentityUserClaim](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [UserId] [int] NOT NULL,
    [ClaimType] [varchar](256) NOT NULL,
    **[ClaimValue] [varchar](256) NULL,**
CONSTRAINT [PK_IdentityUserClaim] PRIMARY KEY CLUSTERED