Added CORS, added specific type for token in AuthToken.cs, added login page to blazor client

This commit is contained in:
2024-08-30 15:10:25 +03:00
parent c631dc99d0
commit 802e42563e
15 changed files with 102 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using ApplicationLayer.InfrastructureServicesInterfaces;
using ApplicationLayer.Services.AuthServices.Common;
using ApplicationLayer.Services.AuthServices.NeededServices;
using Domains.Users;
@@ -14,7 +15,7 @@ public class TokenGenerator(TokenGeneratorOptions options, JwtSecurityTokenHandl
: ITokenGenerator
{
/// <inheritdoc cref="ITokenGenerator.CreateToken"/>
public string CreateToken(User user)
public AuthToken CreateToken(User user)
{
var claims = new List<Claim>
{
@@ -29,6 +30,6 @@ public class TokenGenerator(TokenGeneratorOptions options, JwtSecurityTokenHandl
signingCredentials: options.Credentials,
claims: claims);
return tokenHandler.WriteToken(token);
return new AuthToken(tokenHandler.WriteToken(token));
}
}