-
Notifications
You must be signed in to change notification settings - Fork 241
Add verification of issuer signing key with integration test #2356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1867d98
Sharing the prototype
jmprieur 7edb6ae
Enable mock metadata in samples
GeoK 233b6ec
Fix and test for the signing key issuer validator
jmprieur 95e68af
Fixing the signing key issuer
jmprieur 72d54fd
Adding integration tests
jmprieur 5145b07
Moving the SimulateOidc to IntegrationTests
jmprieur 734cc66
Update
jmprieur 2127424
Reactivate tests disabled by George
jmprieur 232397e
Addressing PR feedback
jmprieur 74e8cb5
Addressing formatting issues
jmprieur fe04a69
Updating the UI test to use ExternalApp.Start
jmprieur 3b88400
Setting the SimulateOidc on Http for the CI build
jmprieur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
tests/DevApps/WebAppCallsWebApiCallsGraph/TodoListService/appsettings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
tests/IntegrationTests/SimulateOidc/Contollers/MetadataController.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.AspNetCore.Authorization; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace SimulateOidc.Controllers | ||
| { | ||
| // We are using a controller rather than static pages here to serve the OIDC metadata | ||
| // so that we can dynamically replace the jwks_uri with the correct URL for this service. | ||
| [Route("v2.0/.well-known")] | ||
| [ApiController] | ||
| [AllowAnonymous] | ||
| public class MetadataController : ControllerBase | ||
| { | ||
| [HttpGet("/v2.0/.well-known/openid-configuration")] | ||
| public IActionResult OpenIdConnectConfiguration() | ||
| { | ||
| // Get the openIdConnectConfiguration from the embedded resource | ||
| string openIdConnectDocumentString = System.Text.Encoding.UTF8.GetString(Properties.Resource.openid_configuration); | ||
|
|
||
| // Replace the jwks URI based on the base URL of this service. | ||
| string hostUrl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/"; | ||
| string openIdConnectDocumentJsonString = openIdConnectDocumentString.Replace("https://localhost/", hostUrl, System.StringComparison.InvariantCulture); | ||
|
|
||
| // The openIdConnectConfiguration is served as a JSON string | ||
| return new ContentResult | ||
| { | ||
| ContentType = "application/json", | ||
| Content = openIdConnectDocumentJsonString, | ||
| StatusCode = 200 | ||
| }; | ||
| } | ||
|
|
||
| [HttpGet("/v2.0/.well-known/keys.json")] | ||
| public IActionResult Keys() | ||
| { | ||
| byte[] keysDocument = Properties.Resource.keys; | ||
| return new FileContentResult(keysDocument, "application/json"); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace SimulateOidc | ||
| { | ||
| public class Program | ||
| { | ||
| public static void Main(string[] args) | ||
| { | ||
| var builder = WebApplication.CreateBuilder(args); | ||
| builder.Services.AddControllers(); | ||
|
|
||
| var app = builder.Build(); | ||
|
|
||
| // Configure the HTTP request pipeline. | ||
| if (!app.Environment.IsDevelopment()) | ||
| { | ||
| app.UseExceptionHandler("/Error"); | ||
| // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
| app.UseHsts(); | ||
| } | ||
|
|
||
| app.UseRouting(); | ||
| app.UseEndpoints(endpoints => | ||
| { | ||
| endpoints.MapControllers(); | ||
| }); | ||
|
|
||
| app.Run(); | ||
| } | ||
| } | ||
| } |
83 changes: 83 additions & 0 deletions
83
tests/IntegrationTests/SimulateOidc/Properties/Resource.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.