mirror of
https://github.com/hmaxnl/DotBased.git
synced 2025-01-18 18:14:20 +01:00
[ADD] Added verifiers, validators & config.
This commit is contained in:
parent
797323789e
commit
5c4ebd2b32
|
@ -1,12 +1,16 @@
|
||||||
using DotBased.AspNet.Authority.Interfaces;
|
using DotBased.AspNet.Authority.Interfaces;
|
||||||
|
using DotBased.AspNet.Authority.Models.Options;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace DotBased.AspNet.Authority;
|
namespace DotBased.AspNet.Authority;
|
||||||
|
|
||||||
public static class AuthorityProviderExtensions
|
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);
|
return new AuthorityBuilder(services);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,4 +21,8 @@
|
||||||
<Folder Include="Models\Security\" />
|
<Folder Include="Models\Security\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -2,7 +2,7 @@ namespace DotBased.AspNet.Authority.Models.Authority;
|
||||||
|
|
||||||
public class AuthorityAttribute
|
public class AuthorityAttribute
|
||||||
{
|
{
|
||||||
public AuthorityAttribute(string attributeKey, string bound) : this()
|
public AuthorityAttribute(string attributeKey, string bound)
|
||||||
{
|
{
|
||||||
AttributeKey = attributeKey;
|
AttributeKey = attributeKey;
|
||||||
BoundId = bound;
|
BoundId = bound;
|
||||||
|
@ -10,7 +10,8 @@ public class AuthorityAttribute
|
||||||
|
|
||||||
public AuthorityAttribute()
|
public AuthorityAttribute()
|
||||||
{
|
{
|
||||||
|
AttributeKey = string.Empty;
|
||||||
|
BoundId = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AttributeKey { get; set; } // ClaimType/Authority.attribute.enabled
|
public string AttributeKey { get; set; } // ClaimType/Authority.attribute.enabled
|
||||||
|
|
|
@ -2,7 +2,7 @@ namespace DotBased.AspNet.Authority.Models.Options;
|
||||||
|
|
||||||
public class SignInOptions
|
public class SignInOptions
|
||||||
{
|
{
|
||||||
public bool RequireValidatedEmail { get; set; }
|
public bool RequireVerifiedEmail { get; set; }
|
||||||
public bool RequireValidatedPhoneNumber { get; set; }
|
public bool RequireVerifiedPhoneNumber { get; set; }
|
||||||
public bool RequireConfirmedAccount { get; set; }
|
public bool RequireConfirmedAccount { get; set; }
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
namespace DotBased.AspNet.Authority.Services;
|
namespace DotBased.AspNet.Authority.Services;
|
||||||
|
|
||||||
public class AuthorityService
|
public class AuthorityManager<TData>
|
||||||
{
|
{
|
||||||
public long GenerateVersion() => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
public long GenerateVersion() => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Validators;
|
||||||
|
|
||||||
|
public interface IPasswordValidator<TUser>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
DotBased.AspNet.Authority/Validators/IUserValidator.cs
Normal file
6
DotBased.AspNet.Authority/Validators/IUserValidator.cs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Validators;
|
||||||
|
|
||||||
|
public interface IUserValidator
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Validators;
|
||||||
|
|
||||||
|
public class PasswordValidator
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
DotBased.AspNet.Authority/Validators/UserValidator.cs
Normal file
6
DotBased.AspNet.Authority/Validators/UserValidator.cs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Validators;
|
||||||
|
|
||||||
|
public class UserValidator
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
DotBased.AspNet.Authority/Verifiers/IEmailVerifier.cs
Normal file
6
DotBased.AspNet.Authority/Verifiers/IEmailVerifier.cs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Verifiers;
|
||||||
|
|
||||||
|
public interface IEmailVerifier
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Verifiers;
|
||||||
|
|
||||||
|
public interface IPhoneNumberVerifier
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
6
DotBased.AspNet.Authority/Verifiers/IUserVerifier.cs
Normal file
6
DotBased.AspNet.Authority/Verifiers/IUserVerifier.cs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
namespace DotBased.AspNet.Authority.Verifiers;
|
||||||
|
|
||||||
|
public class IUserVerifier
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user