Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions GraphExplorerAppModeService/GraphExplorerAppModeService.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>dotnet-GraphExplorerAppModeService-10DEC1C0-DF4C-4EA8-B0A8-54951DB93792</UserSecretsId>
<OutputType>Library</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions GraphExplorerAppModeService/Interfaces/IGraphAppAuthProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GraphExplorerAppModeService.Interfaces
{
interface IGraphAppAuthProvider
{
}
}
12 changes: 12 additions & 0 deletions GraphExplorerAppModeService/Interfaces/IGraphServiceClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GraphExplorerAppModeService.Interfaces
{
interface IGraphServiceClient
{
}
}
19 changes: 19 additions & 0 deletions GraphExplorerAppModeService/Services/GraphAppAuthProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using GraphExplorerAppModeService.Interfaces;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace GraphExplorerAppModeService.Services
{
public class GraphAppAuthProvider : IGraphAppAuthProvider
{
public GraphAppAuthProvider(IConfiguration configuration)
{

}
}
}
18 changes: 18 additions & 0 deletions GraphExplorerAppModeService/Services/GraphClientService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GraphExplorerAppModeService.Interfaces;
using Microsoft.Extensions.Configuration;

namespace GraphExplorerAppModeService.Services
{
class GraphClientService : IGraphServiceClient
{
public GraphClientService(IConfiguration configuration)
{

}
}
}
61 changes: 61 additions & 0 deletions GraphWebApi/Controllers/GraphExplorerAppModeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using GraphExplorerAppModeService.Interfaces;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace GraphWebApi.Controllers
{
[ApiController]
public class GraphExplorerAppModeController : ControllerBase
{
[Route("api/[controller]/{*all}")]
[Route("graphproxy/{*all}")]
[HttpGet]
public async Task<IActionResult> GetAsync(string all, [FromHeader] string Authorization)
{
return await ProcessRequestAsync("GET", all, null, Authorization).ConfigureAwait(false);
}

[Route("api/[controller]/{*all}")]
[Route("graphproxy/{*all}")]
[HttpPost]
public async Task<IActionResult> PostAsync(string all, [FromBody] object body, [FromHeader] string Authorization)
{
return await ProcessRequestAsync("POST", all, body, Authorization).ConfigureAwait(false);
}

[Route("api/[controller]/{*all}")]
[Route("graphproxy/{*all}")]
[HttpDelete]
public async Task<IActionResult> DeleteAsync(string all, [FromHeader] string Authorization)
{
return await ProcessRequestAsync("DELETE", all, null, Authorization).ConfigureAwait(false);
}

[Route("api/[controller]/{*all}")]
[Route("graphproxy/{*all}")]
[HttpPut]
public async Task<IActionResult> PutAsync(string all, [FromBody] object body, [FromHeader] string Authorization)
{
return await ProcessRequestAsync("PUT", all, body, Authorization).ConfigureAwait(false);
}

[Route("api/[controller]/{*all}")]
[Route("graphproxy/{*all}")]
[HttpPatch]
public async Task<IActionResult> PatchAsync(string all, [FromBody] object body, [FromHeader] string Authorization)
{
return await ProcessRequestAsync("PATCH", all, body, Authorization).ConfigureAwait(false);
}

private async Task<IActionResult> ProcessRequestAsync(string method, string all, object content, string Authorizaton)
{

return Ok();
}
}
}
1 change: 1 addition & 0 deletions GraphWebApi/GraphWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<ProjectReference Include="..\ChangesService\ChangesService.csproj" />
<ProjectReference Include="..\CodeSnippetsReflection\CodeSnippetsReflection.csproj" />
<ProjectReference Include="..\FileService\FileService.csproj" />
<ProjectReference Include="..\GraphExplorerAppModeService\GraphExplorerAppModeService.csproj" />
<ProjectReference Include="..\GraphExplorerPermissionsService\GraphExplorerPermissionsService.csproj" />
<ProjectReference Include="..\GraphExplorerSamplesService\GraphExplorerSamplesService.csproj" />
<ProjectReference Include="..\OpenAPIService\OpenAPIService.csproj" />
Expand Down
11 changes: 11 additions & 0 deletions GraphWebApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using TelemetrySanitizerService;
using OpenAPIService.Interfaces;
using OpenAPIService;
using System.Threading.Tasks;

namespace GraphWebApi
{
Expand Down Expand Up @@ -57,6 +58,16 @@ public void ConfigureServices(IServiceCollection services)
ValidAudience = Configuration["AzureAd:Audience"],
ValidIssuer = Configuration["AzureAd:Issuer"]
};
// This is to allow local testing using postman
// To be removed when merged into dev
option.Events = new JwtBearerEvents()
{
OnAuthenticationFailed = context =>
{
context.NoResult();
return Task.FromResult(0);
}
};
Comment thread
v-mschramm marked this conversation as resolved.
});

#region AppInsights
Expand Down
9 changes: 8 additions & 1 deletion GraphWebApi/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"Instance": "https://login.microsoftonline.com/",
"TenantId": "ENTER_TENANT_ID",
"Audience": "ENTER_APP_ID_URI",
"Issuer": "ENTER_ISSUER_URI"
"Issuer": "ENTER_ISSUER_URI",
"ClientId": "YOUR_APP_ID_HERE",
"ClientSecret": "YOUR_APP_PASSWORD_HERE",
"Scopes": "openid email profile offline_access",
"GraphResourceId": "https://graph.microsoft.com/"
},
"Logging": {
"LogLevel": {
Expand Down Expand Up @@ -52,5 +56,8 @@
"SampleQueries": "24",
"Permissions": "24",
"ChangeLog": "24"
},
"GEApplicationMode": {

}
}
6 changes: 6 additions & 0 deletions MSGraphWebApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UtilityService", "UtilitySe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UtilityService.Test", "UtilityService.Test\UtilityService.Test.csproj", "{0F4A15DC-F4CD-415D-A62D-6B0D95ED25E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphExplorerAppModeService", "GraphExplorerAppModeService\GraphExplorerAppModeService.csproj", "{AF515BB3-08B5-41A1-80E6-4529670A6B1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -129,6 +131,10 @@ Global
{0F4A15DC-F4CD-415D-A62D-6B0D95ED25E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F4A15DC-F4CD-415D-A62D-6B0D95ED25E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F4A15DC-F4CD-415D-A62D-6B0D95ED25E8}.Release|Any CPU.Build.0 = Release|Any CPU
{AF515BB3-08B5-41A1-80E6-4529670A6B1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF515BB3-08B5-41A1-80E6-4529670A6B1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF515BB3-08B5-41A1-80E6-4529670A6B1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF515BB3-08B5-41A1-80E6-4529670A6B1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down