Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion UltimateAuth.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<File Path="Readme.md" />
<File Path="Roadmap.md" />
</Folder>
<Project Path="src/CodeBeam.UltimateAuth.AspNetCore/CodeBeam.UltimateAuth.AspNetCore.csproj" Id="30d5db36-6dc8-46f6-9139-8b6b3d6053d5" />
<Project Path="src/CodeBeam.UltimateAuth.AspNetCore/CodeBeam.UltimateAuth.Server.Users.csproj" Id="30d5db36-6dc8-46f6-9139-8b6b3d6053d5" />
<Project Path="src/CodeBeam.UltimateAuth.Client/CodeBeam.UltimateAuth.Client.csproj" Id="eb60a3b7-ba9d-48c9-98ad-b28e879b23bf" />
<Project Path="src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj" />
<Project Path="src/CodeBeam.UltimateAuth.Server/CodeBeam.UltimateAuth.Server.csproj" Id="0a8cdd12-a8c4-4530-87e8-ae778c46322b" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
/// <summary>
/// Administrative user management operations.
/// </summary>
public interface IUAuthUserManagementService<TUserId>
{
Task<UserDto<TUserId>> GetByIdAsync(

Check warning on line 8 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.GetByIdAsync(TUserId, CancellationToken)'

Check warning on line 8 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.GetByIdAsync(TUserId, CancellationToken)'

Check warning on line 8 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.GetByIdAsync(TUserId, CancellationToken)'
TUserId userId,
CancellationToken ct = default);

Task<IReadOnlyList<UserDto<TUserId>>> GetAllAsync(

Check warning on line 12 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.GetAllAsync(CancellationToken)'

Check warning on line 12 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.GetAllAsync(CancellationToken)'

Check warning on line 12 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.GetAllAsync(CancellationToken)'
CancellationToken ct = default);

Task DisableAsync(

Check warning on line 15 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.DisableAsync(TUserId, CancellationToken)'

Check warning on line 15 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.DisableAsync(TUserId, CancellationToken)'

Check warning on line 15 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.DisableAsync(TUserId, CancellationToken)'
TUserId userId,
CancellationToken ct = default);

Task EnableAsync(

Check warning on line 19 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.EnableAsync(TUserId, CancellationToken)'

Check warning on line 19 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.EnableAsync(TUserId, CancellationToken)'

Check warning on line 19 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.EnableAsync(TUserId, CancellationToken)'
TUserId userId,
CancellationToken ct = default);

Task ResetPasswordAsync(

Check warning on line 23 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.ResetPasswordAsync(TUserId, ResetPasswordRequest, CancellationToken)'

Check warning on line 23 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.ResetPasswordAsync(TUserId, ResetPasswordRequest, CancellationToken)'

Check warning on line 23 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserManagementService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserManagementService<TUserId>.ResetPasswordAsync(TUserId, ResetPasswordRequest, CancellationToken)'
TUserId userId,
ResetPasswordRequest request,
CancellationToken ct = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
/// <summary>
/// User self-service operations (profile, password, MFA).
/// </summary>
public interface IUAuthUserProfileService<TUserId>
{
Task<UserProfileDto<TUserId>> GetCurrentAsync(

Check warning on line 8 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.GetCurrentAsync(CancellationToken)'

Check warning on line 8 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.GetCurrentAsync(CancellationToken)'

Check warning on line 8 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.GetCurrentAsync(CancellationToken)'
CancellationToken ct = default);

Task UpdateProfileAsync(

Check warning on line 11 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.UpdateProfileAsync(UpdateProfileRequest, CancellationToken)'

Check warning on line 11 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.UpdateProfileAsync(UpdateProfileRequest, CancellationToken)'

Check warning on line 11 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.UpdateProfileAsync(UpdateProfileRequest, CancellationToken)'
UpdateProfileRequest request,
CancellationToken ct = default);

Task ChangePasswordAsync(

Check warning on line 15 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.ChangePasswordAsync(ChangePasswordRequest, CancellationToken)'

Check warning on line 15 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.ChangePasswordAsync(ChangePasswordRequest, CancellationToken)'

Check warning on line 15 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.ChangePasswordAsync(ChangePasswordRequest, CancellationToken)'
ChangePasswordRequest request,
CancellationToken ct = default);

Task ConfigureMfaAsync(

Check warning on line 19 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.ConfigureMfaAsync(ConfigureMfaRequest, CancellationToken)'

Check warning on line 19 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.ConfigureMfaAsync(ConfigureMfaRequest, CancellationToken)'

Check warning on line 19 in src/CodeBeam.UltimateAuth.AspNetCore/Abstractions/IUAuthUserProfileService.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'IUAuthUserProfileService<TUserId>.ConfigureMfaAsync(ConfigureMfaRequest, CancellationToken)'
ConfigureMfaRequest request,
CancellationToken ct = default);
}
}
1 change: 0 additions & 1 deletion src/CodeBeam.UltimateAuth.AspNetCore/Handlers/.gitkeep

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class AdminUserFilter

Check warning on line 3 in src/CodeBeam.UltimateAuth.AspNetCore/Users/Models/AdminUserFilter.cs

View workflow job for this annotation

GitHub Actions / Build & Test (8.0.x)

Missing XML comment for publicly visible type or member 'AdminUserFilter'

Check warning on line 3 in src/CodeBeam.UltimateAuth.AspNetCore/Users/Models/AdminUserFilter.cs

View workflow job for this annotation

GitHub Actions / Build & Test (10.0.x)

Missing XML comment for publicly visible type or member 'AdminUserFilter'

Check warning on line 3 in src/CodeBeam.UltimateAuth.AspNetCore/Users/Models/AdminUserFilter.cs

View workflow job for this annotation

GitHub Actions / Build & Test (9.0.x)

Missing XML comment for publicly visible type or member 'AdminUserFilter'
{
public bool? IsActive { get; init; }
public bool? IsEmailConfirmed { get; init; }

public string? Search { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class ChangePasswordRequest
{
public required string CurrentPassword { get; init; }
public required string NewPassword { get; init; }

/// <summary>
/// If true, other sessions will be revoked.
/// </summary>
public bool RevokeOtherSessions { get; init; } = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class ConfigureMfaRequest
{
public bool Enable { get; init; }

/// <summary>
/// Optional verification code when enabling MFA.
/// </summary>
public string? VerificationCode { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class ResetPasswordRequest
{
public required string NewPassword { get; init; }

/// <summary>
/// If true, all active sessions will be revoked.
/// </summary>
public bool RevokeSessions { get; init; } = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class UpdateProfileRequest
{
public string? Username { get; init; }
public string? Email { get; init; }
}
}
16 changes: 16 additions & 0 deletions src/CodeBeam.UltimateAuth.AspNetCore/Users/Models/UserDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class UserDto<TUserId>
{
public required TUserId UserId { get; init; }

public string? Username { get; init; }
public string? Email { get; init; }

public bool IsActive { get; init; }
public bool IsEmailConfirmed { get; init; }

public DateTime CreatedAt { get; init; }
public DateTime? LastLoginAt { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace CodeBeam.UltimateAuth.Server.Users
{
public sealed class UserProfileDto<TUserId>
{
public required TUserId UserId { get; init; }

public string? Username { get; init; }
public string? Email { get; init; }

public bool IsEmailConfirmed { get; init; }

public DateTime CreatedAt { get; init; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace CodeBeam.UltimateAuth.Core.Abstractions
{
/// <summary>
/// Provides an abstracted time source for the system.
/// Used to improve testability and ensure consistent time handling.
/// </summary>
public interface IClock
{
DateTime UtcNow { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace CodeBeam.UltimateAuth.Core.Abstractions
{
/// <summary>
/// Securely hashes and verifies user passwords.
/// Designed for slow, adaptive, memory-hard algorithms
/// such as Argon2 or bcrypt.
/// </summary>
public interface IUAuthPasswordHasher
{
string Hash(string password);
bool Verify(string password, string hash);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CodeBeam.UltimateAuth.Core.Contexts;
using CodeBeam.UltimateAuth.Core.Contracts;
using CodeBeam.UltimateAuth.Core.Domain;

namespace CodeBeam.UltimateAuth.Core.Abstractions
Expand All @@ -8,6 +8,6 @@ namespace CodeBeam.UltimateAuth.Core.Abstractions
/// </summary>
public interface ISessionIssuer<TUserId>
{
Task<IssuedSession<TUserId>> IssueAsync(SessionIssueContext<TUserId> context, UAuthSessionChain<TUserId> chain, CancellationToken cancellationToken = default);
Task<IssuedSession<TUserId>> IssueAsync(AuthenticatedSessionContext<TUserId> context, ISessionChain<TUserId> chain, CancellationToken cancellationToken = default);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using CodeBeam.UltimateAuth.Core.Contracts;

namespace CodeBeam.UltimateAuth.Core.Abstractions
{
public interface IUserAuthenticator<TUserId>
{
Task<UserAuthenticationResult<TUserId>> AuthenticateAsync(string? tenantId, string identifier, string secret, CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public interface IUserIdConverter<TUserId>
/// Thrown when the input value cannot be parsed into a valid identifier.
/// </exception>
TUserId FromString(string value);
bool TryFromString(string value, out TUserId userId);

/// <summary>
/// Reconstructs a typed user identifier from its binary representation.
Expand All @@ -41,5 +42,6 @@ public interface IUserIdConverter<TUserId>
/// Thrown when the input binary value cannot be parsed into a valid identifier.
/// </exception>
TUserId FromBytes(byte[] binary);
bool TryFromBytes(byte[] binary, out TUserId userId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace CodeBeam.UltimateAuth.Core.Abstractions
{
/// <summary>
/// Responsible for creating new user identifiers.
/// This abstraction allows UltimateAuth to remain
/// independent from the concrete user ID type.
/// </summary>
/// <typeparam name="TUserId">User identifier type.</typeparam>
public interface IUserIdFactory<TUserId>
{
/// <summary>
/// Creates a new unique user identifier.
/// </summary>
TUserId Create();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using CodeBeam.UltimateAuth.Core.Contracts;

namespace CodeBeam.UltimateAuth.Core.Abstractions
{
/// <summary>
/// Handles authentication flows such as login,
/// logout, session refresh and reauthentication.
/// </summary>
public interface IUAuthFlowService
{
Task<LoginResult> LoginAsync(LoginRequest request, CancellationToken ct = default);

Task<LoginResult> ExternalLoginAsync(ExternalLoginRequest request, CancellationToken ct = default);

Task<MfaChallengeResult> BeginMfaAsync(BeginMfaRequest request, CancellationToken ct = default);

Task<LoginResult> CompleteMfaAsync(CompleteMfaRequest request, CancellationToken ct = default);

Task LogoutAsync(LogoutRequest request, CancellationToken ct = default);

Task LogoutAllAsync(LogoutAllRequest request, CancellationToken ct = default);

Task<SessionRefreshResult> RefreshSessionAsync(SessionRefreshRequest request, CancellationToken ct = default);

Task<ReauthResult> ReauthenticateAsync(ReauthRequest request, CancellationToken ct = default);

Task<PkceChallengeResult> CreatePkceChallengeAsync(PkceCreateRequest request, CancellationToken ct = default);

Task<PkceVerificationResult> VerifyPkceAsync(PkceVerifyRequest request, CancellationToken ct = default);

Task ConsumePkceAsync(PkceConsumeRequest request, CancellationToken ct = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace CodeBeam.UltimateAuth.Core.Abstractions
{
/// <summary>
/// High-level facade for UltimateAuth.
/// Provides access to authentication flows,
/// session lifecycle and user operations.
/// </summary>
public interface IUAuthService<TUserId>
{
IUAuthFlowService Flow { get; }
IUAuthSessionService<TUserId> Sessions { get; }
IUAuthTokenService<TUserId> Tokens { get; }
IUAuthUserService<TUserId> Users { get; }
}
}
Loading