-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Identity web templates #24065
Identity web templates #24065
Conversation
src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/RazorPagesWeb-CSharp.csproj.in
Outdated
Show resolved
Hide resolved
...ctTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/.template.config/template.json
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Startup.cs
Outdated
Show resolved
Hide resolved
...s/Web.ProjectTemplates/content/StarterWeb-CSharp/Services/MicrosoftGraphServiceExtensions.cs
Outdated
Show resolved
Hide resolved
FYI, I plan to make the fixes in this PR so I don't think we need tracking issues in microsoft-identity-web. I assume after we merge the templates here there's no reason to keep the templates in microsoft-identity-web? |
@JunTaoLuo: I don't know about not having them in Microsoft.Identity.Web any longer. |
@jmprieur Looking at the templates test and I want to double check my understanding with the possible configurations Valid scenarios:
Invalid scenarios:
Uncertain scenarios:
I want to ensure I add tests for all valid scenarios. |
...emplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Startup.cs
Show resolved
Hide resolved
Actually both CalledApiUrl and CalledApiScopes need to be specified (they go together). I've provided a default which is graph, but it's not relevant in general
Yes
Same both CalledApiUrl and CalledApiScopes need to be specified (they go together)
Indeed, this is invalid
Indeed, this is invalid
It could be valid, but the templates don't support it today. They could (a bit more work, and more properties as Scopes is used for Graph and for the Web API)
It's a valid and very important (and legacy) scenario: "Web app that signs in users with Azure AD", and "Protected Web API with Azure AD". Developers don't always need to call a downstream API
It's a valid and very important (and legacy) scenario: "Web app that signs in users with Azure AD B2C", and "Protected Web API with Azure AD B2C". Developers don't always need to call a downstream API
It's a valid scenario.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JunTaoLuo, LGTM.
I left a few comments
src/Azure/AzureAD/Authentication.AzureAD.UI/src/Areas/AzureAD/Controllers/AccountController.cs
Outdated
Show resolved
Hide resolved
src/Azure/AzureAD/Authentication.AzureAD.UI/src/AzureADAuthenticationBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Views/Home/Index.cshtml
Show resolved
Hide resolved
@jmprieur I had a typo in my previous comment but to clarify: Valid scenarios:
Invalid scenarios:
Not yet supported:
I'll add a template test, that creates and compiles the generated template for the valid scenarios. Note that I won't be able to test any functionality since I don't know how to set that up. |
...lates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/.template.config/dotnetcli.host.json
Show resolved
Hide resolved
src/Azure/AzureAD/Authentication.AzureAD.UI/src/Areas/AzureAD/Controllers/AccountController.cs
Show resolved
Hide resolved
@@ -9,6 +10,7 @@ namespace Microsoft.AspNetCore.Authentication.AzureADB2C.UI | |||
/// <summary> | |||
/// Options for configuring authentication using Azure Active Directory B2C. | |||
/// </summary> | |||
[Obsolete("This is obsolete and will be removed in a future version. Use Microsoft.Identity.Web instead. See https://aka.ms/ms-identity-web.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are obsoleting this APIs, we need to point to a URL within the official docs that contains details on the migration process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmprieur can you write something like that? Also, for breaking changes, we usually write an announcement like aspnet/Announcements#414. Can you create something like that so we can link to it?
...ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Startup.cs
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs
Show resolved
Hide resolved
...jectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Services/DownstreamWebApi.cs
Show resolved
Hide resolved
public interface IDownstreamWebApi | ||
{ | ||
Task<string> CallWebApi(string relativeEndpoint = "", string[] requiredScopes = null); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason why we need an interface here?
services.AddTokenAcquisition(true); | ||
services.AddSingleton<GraphServiceClient, GraphServiceClient>(serviceProvider => | ||
{ | ||
var tokenAquisitionService = serviceProvider.GetService<ITokenAcquisition>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs to be GetRequiredService if you expect this to not be null.
I'm going to open a separate PR to retarget these changes to preview 8 (rebasing was a hassle since there was a merge commit in between). Let's finish off with Javier's comment on this PR but any new discussion should be opened in the preview 8 PR instead. |
I'm going to transplant the remaining comment to the p8 PR. |
Fixes #24024
Fixes #22726
FYI @jmprieur