Skip to content

Commit

Permalink
Merge pull request #108 from dlmelendez/rel/8.0
Browse files Browse the repository at this point in the history
Rel/8.0
  • Loading branch information
dlmelendez authored Nov 14, 2023
2 parents 5aa94df + a04fa71 commit 1799ac8
Show file tree
Hide file tree
Showing 45 changed files with 1,289 additions and 204 deletions.
10 changes: 9 additions & 1 deletion ElCamino.AspNetCore.Identity.AzureTable.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElCamino.AspNetCore.Identit
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElCamino.AspNetCore.Identity.AzureTable.Model", "src\ElCamino.AspNetCore.Identity.AzureTable.Model\ElCamino.AspNetCore.Identity.AzureTable.Model.csproj", "{C90FB0E3-5BE2-41E7-9DA3-9083C7700F91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElCamino.Azure.Data.Tables", "src\ElCamino.Azure.Data.Tables\ElCamino.Azure.Data.Tables.csproj", "{DAF57676-8534-4A62-BC7B-317753F2A275}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElCamino.Azure.Data.Tables", "src\ElCamino.Azure.Data.Tables\ElCamino.Azure.Data.Tables.csproj", "{DAF57676-8534-4A62-BC7B-317753F2A275}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElCamino.Azure.Data.Tables.Tests", "tests\ElCamino.Azure.Data.Tables.Tests\ElCamino.Azure.Data.Tables.Tests.csproj", "{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -66,6 +68,12 @@ Global
{DAF57676-8534-4A62-BC7B-317753F2A275}.Release|Any CPU.Build.0 = Release|Any CPU
{DAF57676-8534-4A62-BC7B-317753F2A275}.Signed|Any CPU.ActiveCfg = Debug|Any CPU
{DAF57676-8534-4A62-BC7B-317753F2A275}.Signed|Any CPU.Build.0 = Debug|Any CPU
{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}.Release|Any CPU.Build.0 = Release|Any CPU
{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}.Signed|Any CPU.ActiveCfg = Debug|Any CPU
{7A71EC75-781D-42AB-BDF0-C2B6D4EF2B10}.Signed|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Copyright>Copyright © 2023 David Melendez, MIT License</Copyright>
<AssemblyTitle>Azure Table Storage Provider for ASP.NET Identity Core Models</AssemblyTitle>
<Authors>David Melendez</Authors>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<AssemblyName>ElCamino.AspNetCore.Identity.AzureTable.Model</AssemblyName>
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
Expand All @@ -22,24 +22,25 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/dlmelendez/identityazuretable.git</RepositoryUrl>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>7.1</Version>
<Version>8.0</Version>
<Nullable>enable</Nullable>
<PackageProjectUrl>https://dlmelendez.github.io/identityazuretable</PackageProjectUrl>
<!--<DebugType>Full</DebugType>-->
<!-- DebugType Full is needed for test code coverage, but .nuget symbols doesn't like it-->
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Data.Tables" Version="12.8.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="7.0.13" />
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net7.0' ">
<ItemGroup Condition=" '$(TargetFramework)' != 'net8.0' ">
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="6.0.24" />
</ItemGroup>

Expand Down
15 changes: 15 additions & 0 deletions src/ElCamino.AspNetCore.Identity.AzureTable.Model/IGenerateKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@

namespace ElCamino.AspNetCore.Identity.AzureTable.Model
{
/// <summary>
/// Generates keys suitable for table storage
/// </summary>
public interface IGenerateKeys
{
/// <summary>
/// Accept the keyhelper to generate keys for an entity
/// </summary>
/// <param name="keyHelper"></param>
void GenerateKeys(IKeyHelper keyHelper);

/// <summary>
/// Returns the rowkey for the entity without setting it
/// </summary>
/// <param name="keyHelper"></param>
/// <returns></returns>
string PeekRowKey(IKeyHelper keyHelper);

/// <summary>
/// Key Version for the entity
/// </summary>
double KeyVersion { get; set; }
}
}
169 changes: 169 additions & 0 deletions src/ElCamino.AspNetCore.Identity.AzureTable.Model/IKeyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,231 @@

namespace ElCamino.AspNetCore.Identity.AzureTable.Model
{
/// <summary>
/// Manages all table storage keys
/// </summary>
public interface IKeyHelper
{
/// <summary>
/// Key prefix for IdentityUserClaim
/// </summary>
string PreFixIdentityUserClaim { get; }

/// <summary>
/// Key prefix for IdentityUserClaimUpperBound
/// </summary>
string PreFixIdentityUserClaimUpperBound { get; }

/// <summary>
/// Key prefix for IdentityUserRole
/// </summary>
string PreFixIdentityUserRole { get; }

/// <summary>
/// Key prefix for IdentityUserRoleUpperBound
/// </summary>
string PreFixIdentityUserRoleUpperBound { get; }

/// <summary>
/// Key prefix for IdentityUserLogin
/// </summary>
string PreFixIdentityUserLogin { get; }

/// <summary>
/// Key prefix for IdentityUserLoginUpperBound
/// </summary>
string PreFixIdentityUserLoginUpperBound { get; }

/// <summary>
/// Key prefix for IdentityUserEmail
/// </summary>
string PreFixIdentityUserEmail { get; }

/// <summary>
/// Key prefix for IdentityUserToken
/// </summary>
string PreFixIdentityUserToken { get; }

/// <summary>
/// Key prefix for IdentityUserId
/// </summary>
string PreFixIdentityUserId { get; }

/// <summary>
/// Key prefix for IdentityUserIdUpperBound
/// </summary>
string PreFixIdentityUserIdUpperBound { get; }

/// <summary>
/// Key prefix for IdentityUserName
/// </summary>
string PreFixIdentityUserName { get; }

/// <summary>
/// Key Formatter for IdentityUserClaim
/// </summary>
string FormatterIdentityUserClaim { get; }

/// <summary>
/// Key Formatter for IdentityUserRole
/// </summary>
string FormatterIdentityUserRole { get; }

/// <summary>
/// Key Formatter for IdentityUserLogin
/// </summary>
string FormatterIdentityUserLogin { get; }

/// <summary>
/// Key Formatter for IdentityUserEmail
/// </summary>
string FormatterIdentityUserEmail { get; }

/// <summary>
/// Key Formatter for IdentityUserToken
/// </summary>
string FormatterIdentityUserToken { get; }

/// <summary>
/// Key Formatter for IdentityUserId
/// </summary>
string FormatterIdentityUserId { get; }

/// <summary>
/// Key Formatter for IdentityUserName
/// </summary>
string FormatterIdentityUserName { get; }

/// <summary>
/// Key prefix for IdentityRole
/// </summary>
string PreFixIdentityRole { get; }

/// <summary>
/// Key prefix for IdentityRoleUpperBound
/// </summary>
string PreFixIdentityRoleUpperBound { get; }

/// <summary>
/// Key prefix for IdentityRoleClaim
/// </summary>
string PreFixIdentityRoleClaim { get; }

/// <summary>
/// Key Formatter for IdentityRole
/// </summary>
string FormatterIdentityRole { get; }

/// <summary>
/// Key Formatter for IdentityRoleClaim
/// </summary>
string FormatterIdentityRoleClaim { get; }

/// <summary>
/// Generate key for PartitionKeyIndexByLogin
/// </summary>
/// <param name="plainLoginProvider"></param>
/// <param name="plainProviderKey"></param>
/// <returns></returns>
string GeneratePartitionKeyIndexByLogin(string plainLoginProvider, string plainProviderKey);

/// <summary>
/// Generate key for RowKeyUserEmail
/// </summary>
/// <param name="plainEmail"></param>
/// <returns></returns>
string GenerateRowKeyUserEmail(string? plainEmail);

/// <summary>
/// Generate key for UserId
/// </summary>
/// <returns></returns>
string GenerateUserId();

/// <summary>
/// Generate key for RowKeyUserName
/// </summary>
/// <param name="plainUserName"></param>
/// <returns></returns>
string GenerateRowKeyUserName(string? plainUserName);

/// <summary>
/// Generate key for PartitionKeyUserName
/// </summary>
/// <param name="plainUserName"></param>
/// <returns></returns>
string GeneratePartitionKeyUserName(string? plainUserName);

/// <summary>
/// Generate key for RowKeyUserId
/// </summary>
/// <param name="plainUserId"></param>
/// <returns></returns>
string GenerateRowKeyUserId(string? plainUserId);

/// <summary>
/// Generate key for RowKeyIdentityUserRole
/// </summary>
/// <param name="plainRoleName"></param>
/// <returns></returns>
string GenerateRowKeyIdentityUserRole(string? plainRoleName);

/// <summary>
/// Generate key for RowKeyIdentityRole
/// </summary>
/// <param name="plainRoleName"></param>
/// <returns></returns>
string GenerateRowKeyIdentityRole(string? plainRoleName);

/// <summary>
/// Generate key for PartitionKeyIdentityRole
/// </summary>
/// <param name="plainRoleName"></param>
/// <returns></returns>
string GeneratePartitionKeyIdentityRole(string? plainRoleName);

/// <summary>
/// Generate key for RowKeyIdentityUserClaim
/// </summary>
/// <param name="claimType"></param>
/// <param name="claimValue"></param>
/// <returns></returns>
string GenerateRowKeyIdentityUserClaim(string? claimType, string? claimValue);

/// <summary>
/// Generate key for RowKeyIdentityRoleClaim
/// </summary>
/// <param name="claimType"></param>
/// <param name="claimValue"></param>
/// <returns></returns>
string GenerateRowKeyIdentityRoleClaim(string? claimType, string? claimValue);

/// <summary>
/// Generate key for RowKeyIdentityUserToken
/// </summary>
/// <param name="loginProvider"></param>
/// <param name="tokenName"></param>
/// <returns></returns>
string GenerateRowKeyIdentityUserToken(string? loginProvider, string? tokenName);

/// <summary>
/// Generate key for RowKeyIdentityUserLogin
/// </summary>
/// <param name="loginProvider"></param>
/// <param name="providerKey"></param>
/// <returns></returns>
string GenerateRowKeyIdentityUserLogin(string? loginProvider, string? providerKey);

/// <summary>
/// Parse PartitionKey From RowKey for IdentityRole
/// </summary>
/// <param name="rowKey"></param>
/// <returns></returns>
string ParsePartitionKeyIdentityRoleFromRowKey(string rowKey);

/// <summary>
/// Key Version
/// </summary>
double KeyVersion { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,34 @@

namespace ElCamino.AspNetCore.Identity.AzureTable.Model
{
/// <summary>
/// Table Storage Configuration
/// </summary>
public class IdentityConfiguration
{
/// <summary>
/// Optional field, prefixes all given table names
/// </summary>
public string? TablePrefix { get; set; }

/// <summary>
/// Storage connection string
/// </summary>
public string? StorageConnectionString { get; set; }

/// <summary>
/// Optional, default value is AspNetIndex
/// </summary>
public string? IndexTableName { get; set; }

/// <summary>
/// Optional, default value is AspNetUsers
/// </summary>
public string? UserTableName { get; set; }

/// <summary>
/// Optional, default value is AspNetRoles
/// </summary>
public string? RoleTableName { get; set; }

}
Expand Down
Loading

0 comments on commit 1799ac8

Please sign in to comment.