revert: revert authentication response extension

This reverts commit f158bad756.
This commit is contained in:
cuqmbr 2022-07-27 20:00:02 +03:00
parent f158bad756
commit f14ece42ff
5 changed files with 2 additions and 13 deletions

View File

@ -41,7 +41,6 @@ public class AuthenticationController : ControllerBase
return BadRequest("Username or password is incorrect.");
}
var userId = await _authenticationService.GetIdByUsername(request.Username);
return Ok(new AuthenticationResponse { UserId = userId, Token = content } );
return Ok(new AuthenticationResponse { Token = content } );
}
}

View File

@ -14,6 +14,7 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers().AddNewtonsoftJson(o => {
o.SerializerSettings.ContractResolver = new DefaultContractResolver();
o.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
});
builder.Services.AddEndpointsApiExplorer();

View File

@ -59,12 +59,6 @@ public class AuthenticationService
return (true, GenerateJwtToken(AssembleClaimsIdentity(user)));
}
public async Task<int> GetIdByUsername(string username)
{
var dbUser = await _dbContext.Users.FirstAsync(u => u.Username == username);
return dbUser.Id;
}
private ClaimsIdentity AssembleClaimsIdentity(User user)
{
var subject = new ClaimsIdentity(new[] {

View File

@ -2,6 +2,5 @@ namespace DatabaseModels.Responses;
public class AuthenticationResponse
{
public int UserId { get; set; }
public string Token { get; set; } = null!;
}

View File

@ -7,8 +7,4 @@
<RootNamespace>DatabaseModels</RootNamespace>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cp ./bin/Release/net6.0/SharedModels.dll /home/danil/Unity/Projects/untiteled-mobile-game/Assets/SharedModels.dll" />
</Target>
</Project>