< Summary

Information
Class: Syki.Back.Configs.IdentityConfigs
Assembly: Back
File(s): /home/runner/work/syki/syki/Back/Configs/IdentityConfigs.cs
Tag: 22_11348620282
Line coverage
100%
Covered lines: 28
Uncovered lines: 0
Coverable lines: 28
Total lines: 41
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 IServiceCollection services)
 8    {
 29        services.AddIdentity<SykiUser, SykiRole>()
 210            .AddEntityFrameworkStores<SykiDbContext>()
 211            .AddDefaultTokenProviders();
 12
 213        services.Configure<DataProtectionTokenProviderOptions>(options =>
 214        {
 215            options.TokenLifespan = TimeSpan.FromHours(1);
 416        });
 17
 218        services.Configure<IdentityOptions>(options =>
 219        {
 220            options.User.RequireUniqueEmail = true;
 221            options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.+
 422        });
 23
 224        services.Configure<IdentityOptions>(options =>
 225        {
 226            options.Password.RequiredLength = 8;            // The minimum length.
 227            options.Password.RequireDigit = true;           // Requires a number between 0-9.
 228            options.Password.RequireLowercase = true;       // Requires a lowercase character.
 229            options.Password.RequireUppercase = true;       // Requires an uppercase character.
 230            options.Password.RequireNonAlphanumeric = true; // Requires a non-alphanumeric character (@, %, #, !, &, $, 
 231            options.Password.RequiredUniqueChars = 1;       // Requires the minimum number of distinct characters.
 432        });
 33
 234        services.Configure<IdentityOptions>(options =>
 235        {
 236            options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5); // The amount of time a user is locked out
 237            options.Lockout.MaxFailedAccessAttempts = 3;                      // The number of failed access attempts un
 238            options.Lockout.AllowedForNewUsers = true;                        // Determines if a new user can be locked 
 439        });
 240    }
 41}