UserStore creates a new TIdentityRole, rather than the basic IdentityRole.
This commit is contained in:
@@ -9,13 +9,17 @@ namespace Raven.Identity
|
||||
/// </summary>
|
||||
public class IdentityRole : IdentityRole<IdentityRoleClaim>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new IdentityRole.
|
||||
/// </summary>
|
||||
public IdentityRole()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="IdentityRole"/>.
|
||||
/// </summary>
|
||||
/// <param name="roleName">The role name.</param>
|
||||
/// <remarks>
|
||||
/// The Id property is initialized to from a new GUID string value.
|
||||
/// </remarks>
|
||||
public IdentityRole(string roleName)
|
||||
{
|
||||
Name = roleName;
|
||||
@@ -57,7 +61,6 @@ namespace Raven.Identity
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the primary key for this role.
|
||||
/// Format: IdentityRoles/{roleName}
|
||||
/// </summary>
|
||||
public virtual string Id { get; set; }
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
|
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
|
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
|
||||
<Version>6.0.6</Version>
|
||||
<Version>6.1</Version>
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
<RootNamespace>Raven.Identity</RootNamespace>
|
||||
<PackageReleaseNotes>Fixed role.Name and user.Roles case sensitivity, which had been causing authorization issues.</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>Custom IdentityRole types are stored using their type name in the ID. UserStore can now handle custom IdentityRole types.</PackageReleaseNotes>
|
||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Raven.Identity
|
||||
/// <returns>The identity builder.</returns>
|
||||
public static IdentityBuilder AddRavenDbIdentity<TUser, TRole>(this IServiceCollection services, Action<IdentityOptions> setupAction = null)
|
||||
where TUser : IdentityUser
|
||||
where TRole : IdentityRole
|
||||
where TRole : IdentityRole, new()
|
||||
{
|
||||
// Add the AspNet identity system to work with our RavenDB identity objects.
|
||||
IdentityBuilder identityBuilder;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Raven.Identity
|
||||
IUserTwoFactorRecoveryCodeStore<TUser>,
|
||||
IQueryableUserStore<TUser>
|
||||
where TUser : IdentityUser
|
||||
where TRole : IdentityRole
|
||||
where TRole : IdentityRole, new()
|
||||
{
|
||||
private bool _disposed;
|
||||
private readonly Func<IAsyncDocumentSession> getSessionFunc;
|
||||
@@ -401,7 +401,8 @@ namespace Raven.Identity
|
||||
if (existingRoleOrNull == null)
|
||||
{
|
||||
ThrowIfDisposedOrCancelled(cancellationToken);
|
||||
existingRoleOrNull = new IdentityRole(roleNameLowered);
|
||||
existingRoleOrNull = new TRole();
|
||||
existingRoleOrNull.Name = roleNameLowered;
|
||||
await this.DbSession.StoreAsync(existingRoleOrNull, roleId, cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user