-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Update RazorPages, MVC, WebApi templates to use Identity.Web #24167
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
Update RazorPages, MVC, WebApi templates to use Identity.Web #24167
Conversation
- Obsolete AAD v1 APIs
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.
I filed AzureAD/microsoft-identity-web#346 for an AzureAd migration guide, but we'll also need a docs issue for the AspNetCore migration guide that links to theirs.
src/Azure/AzureAD/Authentication.AzureAD.UI/src/AzureADCookieOptionsConfiguration.cs
Show resolved
Hide resolved
...jectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Services/DownstreamWebApi.cs
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Startup.cs
Show resolved
Hide resolved
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.
#24065 (comment) This probably needs to be GetRequiredService if you expect this to not be null.
|
||
namespace Company.WebApplication1 | ||
{ | ||
public interface IDownstreamWebApi |
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.
#24065 (comment) Is there a specific reason why we need an interface here?
@@ -6,3 +6,8 @@ | |||
<h1 class="display-4">Welcome</h1> | |||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p> | |||
</div> | |||
@* #if(GenerateApiOrGraph) |
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.
FYI this doesn't work. The generated templates just has this section verbatim.
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.
I tried fixing this with 3b093a8. It's working as intended but doesn't seem like the right syntax.
...rojectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Controllers/HomeController.cs
Outdated
Show resolved
Hide resolved
} | ||
else | ||
{ | ||
apiResult = $"Error calling the API '{apiUrl}'"; |
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.
Later: Add logging
.AddMicrosoftWebAppCallsWebApi(Configuration, | ||
"AzureAd") |
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.
.AddMicrosoftWebAppCallsWebApi(Configuration, | |
"AzureAd") | |
.AddMicrosoftWebAppCallsWebApi(Configuration, "AzureAd") |
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.
I'll address this in the Blazor templates PR, this appears in several places IIRC.
Hi, Would you please help me with the following things? I want to configure using startup.cs because I want to save user info in DB and add custom claims in the claim principle. following is my Startup.cs
` |
Hi @satishrabari. It looks like you just commented on a closed PR. The team will most probably miss it. If you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context. |
Fixes #24024
Fixes #22726
ported from #24065
fyi @jmprieur