From 2baf4b9dad32c172c8ece5a41d52653bdc095d6f Mon Sep 17 00:00:00 2001 From: Vijay Uppu <913468@dadeschools.net> Date: Thu, 21 Dec 2023 13:22:16 -0500 Subject: [PATCH 1/2] enabled dade school token in user access module --- .../Controllers/EmployeesController.cs | 4 ++-- .../Controllers/UsersAccessController.cs | 16 ++++++++-------- .../appsettings.json | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs index 7ba9f56..f247d17 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Controllers/EmployeesController.cs @@ -19,7 +19,7 @@ namespace DamageAssesment.Api.Employees.Controllers /// /// GET request for retrieving employees. /// - // [Authorize(Roles = "admin")] + [Authorize(Roles = "admin")] [HttpGet("employees")] public async Task GetEmployeesAsync() { @@ -36,7 +36,7 @@ namespace DamageAssesment.Api.Employees.Controllers /// /// GET request for retrieving an employee by ID. /// - // [Authorize(Roles = "admin")] + [Authorize(Roles = "admin")] [HttpGet("employees/{id}")] public async Task GetEmployeeByIdAsync(int id) { diff --git a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs index c17ec40..c5a5c2d 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs @@ -24,7 +24,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers // } // return Unauthorized(result.ErrorMessage); // } - // [Authorize(Policy = "Dadeschools")] + [Authorize(Policy = "Dadeschools")] [HttpPost("token/{employecode}")] public async Task AuthenticateAsync(string employecode) { @@ -36,7 +36,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return Unauthorized(result.ErrorMessage); } - // [Authorize(Policy = "Dadeschools")] + [Authorize(Policy = "Dadeschools")] [HttpPost("refreshtoken")] public async Task RefreshTokenAsync(TokenResponse tokenResponse) { @@ -48,7 +48,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return Unauthorized(result.ErrorMessage); } - // [Authorize(Policy = "DamageApp", Roles ="admin")] + [Authorize(Policy = "DamageApp", Roles = "admin")] [HttpGet("users")] public async Task GetUsersAsync() { @@ -60,7 +60,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return NoContent(); } - // [Authorize(Policy = "DamageApp", Roles = "admin")] + [Authorize(Policy = "DamageApp", Roles = "admin")] [HttpGet("users/{Id}")] public async Task GetUsersAsync(int Id) { @@ -72,7 +72,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return NotFound(); } - // [Authorize(Policy = "DamageApp", Roles = "admin")] + [Authorize(Policy = "DamageApp", Roles = "admin")] [HttpGet("roles")] public async Task GetRolesAsync() { @@ -83,7 +83,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers } return NoContent(); } - // [Authorize(Policy = "DamageApp", Roles = "admin")] + [Authorize(Policy = "DamageApp", Roles = "admin")] [HttpPost("users")] public async Task PostUserAsync(User user) { @@ -95,7 +95,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return BadRequest(result.ErrorMessage); } - // [Authorize(Policy = "DamageApp", Roles = "admin")] + [Authorize(Policy = "DamageApp", Roles = "admin")] [HttpPut("users/{Id}")] public async Task PutUserAsync(int Id, User user) { @@ -110,7 +110,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return BadRequest(result.ErrorMessage); } - // [Authorize(Policy = "DamageApp", Roles = "admin")] + [Authorize(Policy = "DamageApp", Roles = "admin")] [HttpDelete("users/{Id}")] public async Task DeleteUserAsync(int Id) { diff --git a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json index ca3c7b8..8ff9385 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json @@ -24,8 +24,8 @@ "TokenUrl": "https://dev-graph.dadeschools.net/connect/token", "ClientId": "dmapi", "ClientSecret": "bfce2c8d-2064-4a02-b19d-7f1d42b16eae", - "TokenClientId": "damage_assessment_postman", - "TokenClientSecret": "e4774164-f018-44c9-b9d2-3a29fc21db3c", + //"TokenClientId": "damage_assessment_postman", + //"TokenClientSecret": "e4774164-f018-44c9-b9d2-3a29fc21db3c", "scope": "openid profile", "grant_type": "password", "Name": "Dadeschools Identity Server" From eb28885f001f4fad98689f86de108ee418478c0e Mon Sep 17 00:00:00 2001 From: Vijay Uppu <913468@dadeschools.net> Date: Thu, 21 Dec 2023 14:12:15 -0500 Subject: [PATCH 2/2] commented Dadeschool token --- .../Controllers/UsersAccessController.cs | 4 ++-- .../DamageAssesment.Api.UsersAccess/appsettings.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs index c5a5c2d..c913ca1 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/Controllers/UsersAccessController.cs @@ -24,7 +24,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers // } // return Unauthorized(result.ErrorMessage); // } - [Authorize(Policy = "Dadeschools")] + // [Authorize(Policy = "Dadeschools")] [HttpPost("token/{employecode}")] public async Task AuthenticateAsync(string employecode) { @@ -36,7 +36,7 @@ namespace DamageAssesment.Api.UsersAccess.Controllers return Unauthorized(result.ErrorMessage); } - [Authorize(Policy = "Dadeschools")] + // [Authorize(Policy = "Dadeschools")] [HttpPost("refreshtoken")] public async Task RefreshTokenAsync(TokenResponse tokenResponse) { diff --git a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json index 8ff9385..c434226 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.UsersAccess/appsettings.json @@ -22,8 +22,8 @@ "Dadeschools": { "Authority": "https://dev-graph.dadeschools.net", "TokenUrl": "https://dev-graph.dadeschools.net/connect/token", - "ClientId": "dmapi", - "ClientSecret": "bfce2c8d-2064-4a02-b19d-7f1d42b16eae", + "ClientId": "damage_assessment", + "ClientSecret": "p7_6mcKuVDD!nbBi64JLwdAhHH*m9i", //"TokenClientId": "damage_assessment_postman", //"TokenClientSecret": "e4774164-f018-44c9-b9d2-3a29fc21db3c", "scope": "openid profile",