added comments

This commit is contained in:
2024-08-26 11:45:52 +03:00
parent 2eea79711e
commit c86cc70f3f
2 changed files with 9 additions and 2 deletions

View File

@@ -2,7 +2,9 @@
namespace ApplicationLayer.Services.AuthServices.NeededServices;
/// Generates jwt-tokens
public interface ITokenGenerator
{
/// returns jwt-token for specific user
string CreateToken(User user);
}
}

View File

@@ -6,9 +6,14 @@ using Domains.Users;
namespace Infrastructure.Auth;
/// <inheritdoc cref="ITokenGenerator"/>
/// <param name="options">options kind of one in authorization registration in DI methods</param>
/// <param name="tokenHandler">token handler</param>
/// <param name="dateTimeProvider">date time provider</param>
public class TokenGenerator(TokenGeneratorOptions options, JwtSecurityTokenHandler tokenHandler, IDateTimeProvider dateTimeProvider)
: ITokenGenerator
{
/// <inheritdoc cref="ITokenGenerator.CreateToken"/>
public string CreateToken(User user)
{
var claims = new List<Claim>
@@ -26,4 +31,4 @@ public class TokenGenerator(TokenGeneratorOptions options, JwtSecurityTokenHandl
return tokenHandler.WriteToken(token);
}
}
}