[ADD] Base Authority initial commit
This commit is contained in:
10
DotBased.AspNet.Authority/Attributes/ProtectAttribute.cs
Normal file
10
DotBased.AspNet.Authority/Attributes/ProtectAttribute.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace DotBased.AspNet.Authority.Attributes;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the property should be protected.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ProtectAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
13
DotBased.AspNet.Authority/AuthorityBuilder.cs
Normal file
13
DotBased.AspNet.Authority/AuthorityBuilder.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DotBased.AspNet.Authority;
|
||||
|
||||
public class AuthorityBuilder
|
||||
{
|
||||
public AuthorityBuilder(IServiceCollection services)
|
||||
{
|
||||
Services = services;
|
||||
}
|
||||
|
||||
public IServiceCollection Services { get; }
|
||||
}
|
11
DotBased.AspNet.Authority/AuthorityDefaults.cs
Normal file
11
DotBased.AspNet.Authority/AuthorityDefaults.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace DotBased.AspNet.Authority;
|
||||
|
||||
public static class AuthorityDefaults
|
||||
{
|
||||
public static class Scheme
|
||||
{
|
||||
public const string AuthenticationScheme = "Authority.Scheme.Authentication";
|
||||
public const string ExternalScheme = "Authority.Scheme.External";
|
||||
}
|
||||
|
||||
}
|
17
DotBased.AspNet.Authority/AuthorityProviderExtensions.cs
Normal file
17
DotBased.AspNet.Authority/AuthorityProviderExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using DotBased.AspNet.Authority.Interfaces;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DotBased.AspNet.Authority;
|
||||
|
||||
public static class AuthorityProviderExtensions
|
||||
{
|
||||
public static AuthorityBuilder AddAuthorityProvider<TModel>(this IServiceCollection services) where TModel : class
|
||||
{
|
||||
return new AuthorityBuilder(services);
|
||||
}
|
||||
|
||||
public static AuthorityBuilder AddAuthorityStore<TStore>(this AuthorityBuilder authorityBuilder) where TStore : IAuthorityRepository
|
||||
{
|
||||
return authorityBuilder;
|
||||
}
|
||||
}
|
25
DotBased.AspNet.Authority/DotBased.AspNet.Authority.csproj
Normal file
25
DotBased.AspNet.Authority/DotBased.AspNet.Authority.csproj
Normal file
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
|
||||
<HintPath>..\..\..\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\8.0.2\lib\net8.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DotBased\DotBased.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Authentication\" />
|
||||
<Folder Include="Models\Security\" />
|
||||
<Folder Include="Repositories\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@@ -0,0 +1,6 @@
|
||||
namespace DotBased.AspNet.Authority.Interfaces;
|
||||
|
||||
public interface IAttributeRepository
|
||||
{
|
||||
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
namespace DotBased.AspNet.Authority.Interfaces;
|
||||
|
||||
public interface IAuthorityRepository
|
||||
{
|
||||
|
||||
}
|
6
DotBased.AspNet.Authority/Interfaces/IRoleRepository.cs
Normal file
6
DotBased.AspNet.Authority/Interfaces/IRoleRepository.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace DotBased.AspNet.Authority.Interfaces;
|
||||
|
||||
public interface IRoleRepository
|
||||
{
|
||||
|
||||
}
|
6
DotBased.AspNet.Authority/Interfaces/IUserRepository.cs
Normal file
6
DotBased.AspNet.Authority/Interfaces/IUserRepository.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace DotBased.AspNet.Authority.Interfaces;
|
||||
|
||||
public interface IUserRepository
|
||||
{
|
||||
|
||||
}
|
10
DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs
Normal file
10
DotBased.AspNet.Authority/Models/Authority/AuthorityUser.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace DotBased.AspNet.Authority.Models.Authority;
|
||||
|
||||
public class AuthorityUser : AuthorityUserBase<Guid>
|
||||
{
|
||||
public AuthorityUser()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
CreatedDate = DateTime.Now;
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
using DotBased.AspNet.Authority.Attributes;
|
||||
|
||||
namespace DotBased.AspNet.Authority.Models.Authority;
|
||||
|
||||
public abstract class AuthorityUserBase<TKey> where TKey : IEquatable<TKey>
|
||||
{
|
||||
public TKey Id { get; set; }
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public bool Locked { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string PasswordHash { get; set; }
|
||||
|
||||
public DateTime CreatedDate { get; set; }
|
||||
|
||||
public bool TwoFactorEnabled { get; set; }
|
||||
|
||||
|
||||
[Protect]
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
public bool EmailConfirmed { get; set; }
|
||||
|
||||
[Protect]
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
public bool PhoneNumberConfirmed { get; set; }
|
||||
|
||||
}
|
6
DotBased.AspNet.Authority/Services/AuthorityService.cs
Normal file
6
DotBased.AspNet.Authority/Services/AuthorityService.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace DotBased.AspNet.Authority.Services;
|
||||
|
||||
public class AuthorityService
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user