added comments
This commit is contained in:
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
namespace ApplicationLayer.Services.AuthServices.NeededServices;
|
namespace ApplicationLayer.Services.AuthServices.NeededServices;
|
||||||
|
|
||||||
|
/// Generates jwt-tokens
|
||||||
public interface ITokenGenerator
|
public interface ITokenGenerator
|
||||||
{
|
{
|
||||||
|
/// returns jwt-token for specific user
|
||||||
string CreateToken(User user);
|
string CreateToken(User user);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,14 @@ using Domains.Users;
|
|||||||
|
|
||||||
namespace Infrastructure.Auth;
|
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)
|
public class TokenGenerator(TokenGeneratorOptions options, JwtSecurityTokenHandler tokenHandler, IDateTimeProvider dateTimeProvider)
|
||||||
: ITokenGenerator
|
: ITokenGenerator
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc cref="ITokenGenerator.CreateToken"/>
|
||||||
public string CreateToken(User user)
|
public string CreateToken(User user)
|
||||||
{
|
{
|
||||||
var claims = new List<Claim>
|
var claims = new List<Claim>
|
||||||
@@ -26,4 +31,4 @@ public class TokenGenerator(TokenGeneratorOptions options, JwtSecurityTokenHandl
|
|||||||
|
|
||||||
return tokenHandler.WriteToken(token);
|
return tokenHandler.WriteToken(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user