-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Update Identity Components in Blazor project template #51134
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
19 commits
Select commit
Hold shift + click to select a range
7bc9463
Add auth with global interactivity
SteveSandersonMS 51b3e9b
Make AddComponentRenderMode param nullable
halter73 471302c
Address API review feedback
halter73 a96b2b9
Update Can~not~AddNullComponentRenderMode test
halter73 48ccec8
Fix NavMenu.razor output
halter73 425bd12
Add antiforgery token to forms rendered interactively on the server
halter73 c5663da
Simplify Email.razor
halter73 13a8e2c
Fix Email.razor's default NewEmail
halter73 fac57d1
Add LogoutForm.razor back
halter73 93073a3
External login improvements
halter73 4f4b0f5
Don't really add a null render mode to the tree
halter73 051c204
Revert "Add LogoutForm.razor back"
halter73 91e24ea
private HttpContext HttpContext { get; set; } = default!;
halter73 2350856
Merge branch 'release/8.0'
halter73 1216701
Test more "dotnet new blazor" project templates
halter73 d308c1d
Test Auth.razor
halter73 5efd8d5
Fix app.css color replacement
halter73 dea2254
Merge branch 'release/8.0'
halter73 b1eb901
clean up
halter73 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
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
23 changes: 23 additions & 0 deletions
23
...zorComponents/Pages/Forms/FormRenderedWithServerInteractivityCanUseAntiforgeryToken.razor
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,23 @@ | ||
@page "/forms/antiforgery-server-interactive" | ||
|
||
@using Microsoft.AspNetCore.Components.Forms | ||
|
||
@attribute [RenderModeInteractiveServer] | ||
|
||
<h3>FormRenderedWithServerInteractivityCanUseAntiforgeryToken</h3> | ||
|
||
<form action="verify-antiforgery" method="post" @formname="verify-antiforgery"> | ||
<AntiforgeryToken /> | ||
<input type="text" id="value" name="value" /> | ||
<input id="send" name="send" type="submit" value="Send" /> | ||
</form> | ||
|
||
@if (HttpContext is null) | ||
{ | ||
<p id="really-ready">Interactively rendered!</p> | ||
} | ||
|
||
@code { | ||
[CascadingParameter] | ||
HttpContext? HttpContext { get; set; } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generating template-baselines.json | ||
|
||
For small project template changes, you may be able to edit the `template-baselines.json` file manually. This is a good way to ensure you have correct expectations about the effects of your changes. | ||
|
||
For larger changes such as adding entirely new templates, it may be impractical to type out the changes to `template-baselines.json` manually. In those cases you can follow a procedure like the following. | ||
|
||
1. Ensure you've configured the necessary environment variables: | ||
- `set PATH=c:\git\dotnet\aspnetcore\.dotnet\;%PATH%` (update path as needed) | ||
- `set DOTNET_ROOT=c:\git\dotnet\aspnetcore\.dotnet` (update path as needed) | ||
2. Get to a position where you can execute the modified template(s) locally, i.e.: | ||
- Use `dotnet pack ProjectTemplatesNoDeps.slnf` (possibly with `--no-restore --no-dependencies`) to regenerate `Microsoft.DotNet.Web.ProjectTemplates.*.nupkg` | ||
- Run one of the `scripts/*.ps1` scripts to install your template pack and execute your chosen template. For example, run `powershell .\scripts\Run-BlazorWeb-Locally.ps1` | ||
- Once that has run, you should see your updated template listed when you execute `dotnet new list` or `dotnet new YourTemplateName --help`. At the point you can run `dotnet new YourTemplateName -o SomePath` directly if you want. However each time you edit template sources further, you will need to run `dotnet new uninstall Microsoft.DotNet.Web.ProjectTemplates.8.0` and then go back to the start of this whole step. | ||
- Tip: the following command combines the above steps, to go directly from editing template sources to an updated local project output: `dotnet pack ProjectTemplatesNoDeps.slnf --no-restore --no-dependencies && dotnet new uninstall Microsoft.DotNet.Web.ProjectTemplates.8.0 && rm -rf scripts\MyBlazorApp && powershell .\scripts\Run-BlazorWeb-Locally.ps1` | ||
3. After generating a particular project's output, the following can be run in a Bash prompt (e.g., using WSL): | ||
- `cd src/ProjectTemplates/scripts` | ||
- `export PROJECT_NAME=MyBlazorApp` (update as necessary - note this is the name of the directly under `scripts` containing your project output) | ||
- `find $PROJECT_NAME -type f -not -path "*/obj/*" -not -path "*/bin/*" -not -path "*/.publish/*" | sed -e "s/^$PROJECT_NAME\///" | sed -e "s/$PROJECT_NAME/{ProjectName}/g" | sed 's/.*/ "&",/' | sort -f` | ||
- This will emit the JSON-formatted lines you can manually insert into the relevant place inside `template-baselines.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
2 changes: 2 additions & 0 deletions
2
...mplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp.Client/UserInfo.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
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.