dotnet / dotnet/aspnetcore

Add minimum length attributes to Identity classes

Open
#45,896 3 comments 0 reactions 0 assignees View on GitHub
area-identity enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

I am trying to set a minimum Length for all strings, if not specified, in ef core's ConfigureConventions, so it won't default to max. Of course my DbContext inherits from IdentityDbContext. So PasswordHash got affected... and broke.
```
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.Properties()
.HaveMaxLength(25);
}
```

### Describe the solution you'd like

Please set PasswordHash (and other length sensitive fields) default max length in the model.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.