Adding endpoint to autheticate from mobile

This commit is contained in:
Reginald Cherenfant Jasmin 2023-12-21 16:05:50 -05:00
parent 4f478585cf
commit 4b863687d3
3 changed files with 14 additions and 13 deletions

View File

@ -14,16 +14,17 @@ namespace DamageAssesment.Api.UsersAccess.Controllers
{ {
this.userAccessProvider = userAccessProvider; this.userAccessProvider = userAccessProvider;
} }
// [HttpPost("dadeschooltoken")] [HttpPost("authenticate")]
// public async Task<ActionResult> DadeSchoolAuthenticateAsync(string username, string password) public async Task<ActionResult> DadeSchoolAuthenticateAsync(UserCredentials userCredentials)
//{ {
// var result = await userAccessProvider.DadeSchoolAuthenticateAsync(username, password); var result = await userAccessProvider.DadeSchoolAuthenticateAsync(userCredentials.username, userCredentials.password);
// if (result.IsSuccess) if (result.IsSuccess)
// { {
// return Ok(result.TokenResponse); return Ok(result.TokenResponse);
// } }
// return Unauthorized(result.ErrorMessage); return Unauthorized(result.ErrorMessage);
// } }
// [Authorize(Policy = "Dadeschools")] // [Authorize(Policy = "Dadeschools")]
[HttpPost("token/{employecode}")] [HttpPost("token/{employecode}")]
public async Task<ActionResult> AuthenticateAsync(string employecode) public async Task<ActionResult> AuthenticateAsync(string employecode)

View File

@ -1,5 +1,5 @@
public class UserCredentials public class UserCredentials
{ {
public string username { get; set; } public string username { get; set; }
// public string? password { get; set; } public string password { get; set; }
} }

View File

@ -20,8 +20,8 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"Dadeschools": { "Dadeschools": {
"Authority": "https://dev-graph.dadeschools.net", "Authority": "https://graph2.dadeschools.net",
"TokenUrl": "https://dev-graph.dadeschools.net/connect/token", "TokenUrl": "https://graph2.dadeschools.net/connect/token",
"ClientId": "dmapi", "ClientId": "dmapi",
"ClientSecret": "bfce2c8d-2064-4a02-b19d-7f1d42b16eae", "ClientSecret": "bfce2c8d-2064-4a02-b19d-7f1d42b16eae",
"TokenClientId": "damage_assessment_postman", "TokenClientId": "damage_assessment_postman",