< Summary - Syki

Information
Class: Syki.Back.Configs.IdentityConfigs
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Configs/IdentityConfigs.cs
Tag: 4_16869239191
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 43
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddIdentityConfigs(...)100%11100%

File(s)

/home/runner/work/syki/syki/Back/Configs/IdentityConfigs.cs

#LineLine coverage
 1using Syki.Back.Features.Cross.CreateUser;
 2
 3namespace Syki.Back.Configs;
 4
 5public static class IdentityConfigs
 6{
 7    public static void AddIdentityConfigs(this WebApplicationBuilder builder)
 8    {
 49        builder.Services.AddIdentity<SykiUser, SykiRole>()
 410            .AddEntityFrameworkStores<SykiDbContext>()
 411            .AddDefaultTokenProviders();
 12
 13        // TODO: Validate this with integration tests (password reset)
 414        builder.Services.Configure<DataProtectionTokenProviderOptions>(options =>
 415        {
 216            options.TokenLifespan = TimeSpan.FromHours(1);
 617        });
 18
 419        builder.Services.Configure<IdentityOptions>(options =>
 420        {
 221            options.User.RequireUniqueEmail = true;
 222            options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.+
 623        });
 24
 425        builder.Services.Configure<IdentityOptions>(options =>
 426        {
 227            options.Password.RequiredLength = 8;            // The minimum length.
 228            options.Password.RequireDigit = true;           // Requires a number between 0-9.
 229            options.Password.RequireLowercase = true;       // Requires a lowercase character.
 230            options.Password.RequireUppercase = true;       // Requires an uppercase character.
 231            options.Password.RequiredUniqueChars = 1;       // Requires the minimum number of distinct characters.
 232            options.Password.RequireNonAlphanumeric = true; // Requires a non-alphanumeric character (@, %, #, !, &, $, 
 633        });
 34
 35        // TODO: Validate this with integration tests
 436        builder.Services.Configure<IdentityOptions>(options =>
 437        {
 238            options.Lockout.AllowedForNewUsers = true;                        // Determines if a new user can be locked 
 239            options.Lockout.MaxFailedAccessAttempts = 3;                      // The number of failed access attempts un
 240            options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5); // The amount of time a user is locked out
 641        });
 442    }
 43}