Can I extend the IdentityServer 4 models?

Viewed 491

I am working on a project using ASP.Net Core and Identity Server 4. The project is using Entity Framework Core in order to store the Identity Server models.

Identity Server generates its own DbContexts (ConfigurationDbContext and PersistedGrantsDbContext) and these contexts are injected in the Startup file of the project, like so:

Startup.cs

var identityServer =  services.AddIdentityServer()
            .AddTemporarySigningCredential()
            .AddConfigurationStore(builder => builder.UseSqlServer(connectionString,
                options => options.MigrationsAssembly(migrationsAssembly)))
            .AddOperationalStore(builder => builder.UseSqlServer(connectionString,
                options => options.MigrationsAssembly(migrationsAssembly)))
            .AddAspNetIdentity<ApplicationUser>()
            .AddProfileService<IdentityProfileService>();

For the purposes of the project all of our models use a row version property in order to catch any concurrency issues during update.

Property definition in the model

     /// <summary>
    /// Concurrency stamp for model
    /// </summary>
    [Timestamp]
    public byte[] RowVersion { get; set; }

The question is, how can we extend the default models of IdentityServer 4? Also, should we even try to extend those models?

I am open to any advice, suggestions and alternatives.
Thank you.

1 Answers
Related