[ADD] Added verifiers, validators & config.

This commit is contained in:
max 2024-12-23 01:26:21 +01:00
parent 797323789e
commit 5c4ebd2b32
12 changed files with 57 additions and 6 deletions

View File

@ -1,12 +1,16 @@
using DotBased.AspNet.Authority.Interfaces;
using DotBased.AspNet.Authority.Models.Options;
using Microsoft.Extensions.DependencyInjection;
namespace DotBased.AspNet.Authority;
public static class AuthorityProviderExtensions
{
public static AuthorityBuilder AddAuthorityProvider<TModel>(this IServiceCollection services) where TModel : class
public static AuthorityBuilder AddAuthorityProvider<TModel>(this IServiceCollection services, Action<AuthorityOptions> optionsAction) where TModel : class
{
services.AddOptions();
// Configure required classes, services, etc.
services.Configure<AuthorityOptions>(optionsAction);
return new AuthorityBuilder(services);
}

View File

@ -21,4 +21,8 @@
<Folder Include="Models\Security\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@ namespace DotBased.AspNet.Authority.Models.Authority;
public class AuthorityAttribute
{
public AuthorityAttribute(string attributeKey, string bound) : this()
public AuthorityAttribute(string attributeKey, string bound)
{
AttributeKey = attributeKey;
BoundId = bound;
@ -10,7 +10,8 @@ public class AuthorityAttribute
public AuthorityAttribute()
{
AttributeKey = string.Empty;
BoundId = string.Empty;
}
public string AttributeKey { get; set; } // ClaimType/Authority.attribute.enabled

View File

@ -2,7 +2,7 @@ namespace DotBased.AspNet.Authority.Models.Options;
public class SignInOptions
{
public bool RequireValidatedEmail { get; set; }
public bool RequireValidatedPhoneNumber { get; set; }
public bool RequireVerifiedEmail { get; set; }
public bool RequireVerifiedPhoneNumber { get; set; }
public bool RequireConfirmedAccount { get; set; }
}

View File

@ -1,6 +1,6 @@
namespace DotBased.AspNet.Authority.Services;
public class AuthorityService
public class AuthorityManager<TData>
{
public long GenerateVersion() => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Validators;
public interface IPasswordValidator<TUser>
{
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Validators;
public interface IUserValidator
{
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Validators;
public class PasswordValidator
{
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Validators;
public class UserValidator
{
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Verifiers;
public interface IEmailVerifier
{
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Verifiers;
public interface IPhoneNumberVerifier
{
}

View File

@ -0,0 +1,6 @@
namespace DotBased.AspNet.Authority.Verifiers;
public class IUserVerifier
{
}