Skip to content

Commit 7f155d0

Browse files
merge Master com Refactor
2 parents 8e11341 + 20ac7ef commit 7f155d0

23 files changed

Lines changed: 156 additions & 23 deletions
0 Bytes
Binary file not shown.

.vs/Todo/v17/.suo

1 KB
Binary file not shown.
50.8 KB
Binary file not shown.
24 Bytes
Binary file not shown.

Controllers/TaskManagerController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace Todo.Controllers
1111
{
1212
[ApiController]
13+
1314
public class TaskManagerController : ControllerBase
1415
{
1516
private readonly TaskManagerServices _taskManagerServices;
@@ -19,6 +20,7 @@ public TaskManagerController(TaskManagerServices taskManagerServices)
1920
_taskManagerServices = taskManagerServices;
2021
}
2122

23+
[Authorize]
2224
[HttpGet("/TasksToDo")]
2325
public IActionResult Get()
2426
{
@@ -59,6 +61,7 @@ public IActionResult ListAllTasks()
5961
}
6062
}
6163

64+
[Authorize]
6265
[HttpGet("ListTaskByUser/{userId}")]
6366
public IActionResult ListTarefaByUser(
6467
[FromRoute] int userId)

Program.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text;
88
using Microsoft.OpenApi.Models;
99
using Todo.Services;
10+
using Todo;
1011

1112
var builder = WebApplication.CreateBuilder(args);
1213

@@ -38,11 +39,18 @@
3839
builder.Services.AddScoped<LoginService>();
3940

4041

41-
builder.Services.AddAuthentication(x =>
42-
{
43-
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
44-
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
45-
});
42+
var key = Encoding.ASCII.GetBytes(Settings.Secret);
43+
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
44+
.AddJwtBearer(options =>
45+
{
46+
options.TokenValidationParameters = new TokenValidationParameters
47+
{
48+
ValidateIssuerSigningKey = true,
49+
IssuerSigningKey = new SymmetricSecurityKey(key),
50+
ValidateIssuer = false,
51+
ValidateAudience = false,
52+
};
53+
});
4654

4755
var app = builder.Build();
4856
app.UseSwagger();

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
<h1 align="center">Todo List backend</h1>
2+
<div align="center">
3+
<h3>Acompanhe a Produtividade do Projeto</h2>
4+
<a href="https://wakatime.com/badge/github/Romulo-Queiroz/Task-Manager-Backend"><img src="https://wakatime.com/badge/github/Romulo-Queiroz/Task-Manager-Backend.svg" alt="wakatime"></a>
5+
<p>Visão Geral do Tempo Investido</p>
6+
</div>
27

38
<br />
49

510
# Iniciando o projeto
611
Para rodar o projeto você precisa antes de algumas ferramentas instaladas:
712
* Visual Studio (Preferência)
8-
* ter o <a href="https://github.com/Romulo-Queiroz/todoListFront" target="blank">Frontend</a> em sua máquina
13+
* ter o <a href="https://github.com/Romulo-Queiroz/Task-Manager-Angular.git" target="blank">Frontend</a> em sua máquina
914
#### Alguns pacotes do NuGet como:
1015
* Microsoft.EntityFrameworkCore
1116
* Microsoft.EntityFrameworkCore.Design

Todo.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ VisualStudioVersion = 17.7.34018.315
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Todo", "Todo.csproj", "{468AD31C-CA0E-4A93-B129-C3F5D5026059}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAplicationTestWithXunit", "..\..\..\OneDrive\Documentos\WebAplicationTestWithXunit\WebAplicationTestWithXunit.csproj", "{74F9DC98-7DA1-40D1-9E4D-51105E37C2F8}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
1517
{468AD31C-CA0E-4A93-B129-C3F5D5026059}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{468AD31C-CA0E-4A93-B129-C3F5D5026059}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{468AD31C-CA0E-4A93-B129-C3F5D5026059}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{74F9DC98-7DA1-40D1-9E4D-51105E37C2F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{74F9DC98-7DA1-40D1-9E4D-51105E37C2F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{74F9DC98-7DA1-40D1-9E4D-51105E37C2F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{74F9DC98-7DA1-40D1-9E4D-51105E37C2F8}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

bin/Debug/net7.0/Todo.dll

7.5 KB
Binary file not shown.

bin/Debug/net7.0/Todo.exe

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)