feat(core): add shared auth models for encrypted login
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
namespace JdeScoping.Core.Models.Auth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Encrypted login payload sent from client to API.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="EncryptedData">Base64-encoded RSA-encrypted JSON of LoginModel</param>
|
||||||
|
public record EncryptedLoginRequest(string EncryptedData);
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace JdeScoping.Core.Models.Auth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Login credentials model shared by Client and API.
|
||||||
|
/// </summary>
|
||||||
|
public class LoginModel
|
||||||
|
{
|
||||||
|
[Required(ErrorMessage = "Username is required")]
|
||||||
|
public string Username { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "Password is required")]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using JdeScoping.Core.Models;
|
||||||
|
|
||||||
|
namespace JdeScoping.Core.Models.Auth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Result returned from login API endpoint.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Success">Whether authentication succeeded</param>
|
||||||
|
/// <param name="ErrorMessage">Error message if failed</param>
|
||||||
|
/// <param name="User">User info if successful</param>
|
||||||
|
public record LoginResultModel(
|
||||||
|
bool Success,
|
||||||
|
string? ErrorMessage,
|
||||||
|
UserInfo? User);
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace JdeScoping.Core.Models.Auth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Server's RSA public key for client-side encryption.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="PublicKeyPem">PEM-encoded RSA public key</param>
|
||||||
|
public record PublicKeyResponse(string PublicKeyPem);
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using System.Runtime.CompilerServices;
|
|
||||||
using JdeScoping.DataSync.Contracts;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace JdeScoping.DataSync.Fetchers;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Base class for mock data fetchers used during development.
|
|
||||||
/// Returns empty results - real implementations will query source databases.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TEntity">The entity type being fetched.</typeparam>
|
|
||||||
public abstract class MockDataFetcher<TEntity> : IDataFetcher<TEntity> where TEntity : class
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Logger instance.
|
|
||||||
/// </summary>
|
|
||||||
protected readonly ILogger Logger;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="MockDataFetcher{TEntity}"/> class.
|
|
||||||
/// </summary>
|
|
||||||
protected MockDataFetcher(ILogger logger)
|
|
||||||
{
|
|
||||||
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
public virtual async IAsyncEnumerable<TEntity> FetchAsync(
|
|
||||||
DateTime? minimumDt,
|
|
||||||
[EnumeratorCancellation] CancellationToken cancellationToken = default)
|
|
||||||
{
|
|
||||||
Logger.LogWarning(
|
|
||||||
"MockDataFetcher<{EntityType}> returning empty results. Implement real fetcher for production.",
|
|
||||||
typeof(TEntity).Name);
|
|
||||||
|
|
||||||
// Return empty enumerable - real implementations will query source databases
|
|
||||||
await Task.CompletedTask;
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user