Table of Contents

Class ValidateOtpCommandHandler

Namespace
SEBT.Portal.UseCases.Auth
Assembly
SEBT.Portal.UseCases.dll

Handles the validation of one-time passwords (OTP) for user authentication.

public class ValidateOtpCommandHandler : ICommandHandler<ValidateOtpCommand, string>
Inheritance
object
ValidateOtpCommandHandler
Implements

Remarks

This handler validates the OTP provided by the user against the stored OTP in the repository. If validation succeeds, the OTP is deleted from the repository to prevent reuse, the user is retrieved or created, and a JWT token is generated with ID proofing status included in the claims.

Constructors

ValidateOtpCommandHandler(IOtpRepository, IUserRepository, ILocalLoginTokenService, IValidator<ValidateOtpCommand>, ILogger<ValidateOtpCommandHandler>)

Handles the validation of one-time passwords (OTP) for user authentication.

public ValidateOtpCommandHandler(IOtpRepository otpRepository, IUserRepository userRepository, ILocalLoginTokenService jwtTokenService, IValidator<ValidateOtpCommand> validator, ILogger<ValidateOtpCommandHandler> logger)

Parameters

otpRepository IOtpRepository

Repository for OTP storage and retrieval operations.

userRepository IUserRepository

Repository for user data and ID proofing status.

jwtTokenService ILocalLoginTokenService

Service for generating JWT tokens for authenticated users.

validator IValidator<ValidateOtpCommand>

Validator for the ValidateOtpCommand.

logger ILogger<ValidateOtpCommandHandler>

Logger for tracking OTP validation attempts and results.

Remarks

This handler validates the OTP provided by the user against the stored OTP in the repository. If validation succeeds, the OTP is deleted from the repository to prevent reuse, the user is retrieved or created, and a JWT token is generated with ID proofing status included in the claims.

Methods

Handle(ValidateOtpCommand, CancellationToken)

public Task<Result<string>> Handle(ValidateOtpCommand command, CancellationToken cancellationToken = default)

Parameters

command ValidateOtpCommand
cancellationToken CancellationToken

Returns

Task<Result<string>>