public async Task <IActionResult> AzureAdLateralMovement() { var tenantId = ((ClaimsIdentity)User.Identity) .FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value; await CosmosDbHelper.InitializeCosmosDb(tenantId); var graphClient = _graphSdkHelper.GetAuthenticatedClient((ClaimsIdentity)User.Identity); var azureActiveDirectoryHelper = new AzureActiveDirectoryHelper(graphClient, HttpContext); List <string> lateralMovementDataList = null; try { lateralMovementDataList = await azureActiveDirectoryHelper.RunAzureActiveDirectoryApplication(); } catch (ServiceException e) { if (e.Error.Code == "TokenNotFound") { foreach (var cookie in Request.Cookies.Keys) { Response.Cookies.Delete(cookie); } return(RedirectToAction(nameof(Index), "Home")); } } catch (Exception e) { return(RedirectToAction(nameof(Index), "Home")); } return(View(lateralMovementDataList)); }
public async Task <ActionResult> AzureActiveDirectoryLateralMovement() { var azureActiveDirectoryApplication = new Models.AzureActiveDirectoryApplication(HttpContext); var tenantID = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value; await CosmosDbHelper.InitializeCosmosDb(tenantID); var outputView = await azureActiveDirectoryApplication.RunAzureActiveDirectoryApplication(); return(View(outputView)); }