I have an ASP.NET Core 6 Web API with Swagger, it has an endpoint /api/User/UserLogIn, with a UserDTO (id, username, password, roles, and display name) as parameter. I need to get the user's roles or claims of the user from Azure Active Directory.
[HttpGet]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<List<UserDTO>>> GetUsers()
{
List<UserDTO> LstUserDTO = new List<UserDTO>();
try
{
_logger.LogInformation($"{nameof(UserController)} -> {nameof(GetUsers)} started at: {DateTime.Now}");
LstUserDTO = await _azureActiveDirectoryRepository.GetUsers(); //TODO: How get users from Azure Active Directory
_logger.LogInformation($"{nameof(UserController)} -> {nameof(GetUsers)} completed at: {DateTime.Now}");
}
catch (Exception ex) {
_logger.LogError("Error: " + ex.Message);
}
return new OkObjectResult(LstUserDTO); }
Could you please help me?
Thank you & regards,



