-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Auth with global interactivity #50920
Closed
SteveSandersonMS
wants to merge
23
commits into
release/8.0-rc2
from
stevesa/auth-with-global-interactivity
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e011406
Begin making it work
SteveSandersonMS 6c49a7a
Simplify
SteveSandersonMS 380c05b
Fix other rendermodes
SteveSandersonMS a369d51
Seems that nested "if" is not supported
SteveSandersonMS 1574e2b
Start moving account files into a single subdir
SteveSandersonMS cb06df0
Fix paths
SteveSandersonMS 98a222f
Add RedirectToLogin
SteveSandersonMS f35f3ba
Fixes for RedirectToLogin
SteveSandersonMS 8fec9e9
Fix for per-page interactivity
SteveSandersonMS 9136aae
Add missing BOMs
SteveSandersonMS a79a907
Baseline: "new blazor --interactivity none"
SteveSandersonMS beffe3b
Baseline NoInteractivityWithIndividualAuth
SteveSandersonMS 92252ee
Baseline UseServerWithIndividualAuth
SteveSandersonMS 7f77286
Baseline UseServerWithIndividualAuthAndSqlServer
SteveSandersonMS e7346a4
Baseline UseWebAssemblyWithIndividualAuth
SteveSandersonMS 48621a2
Baseline UseServerAndWebAssemblyWithIndividualAuth
SteveSandersonMS 1ec264a
Baseline EmptyUseServerAndWebAssemblyWithIndividualAuth
SteveSandersonMS d1164ee
Baseline ServerInteractiveAtRootWithIndividualAuth
SteveSandersonMS 7fd02fe
More new baselines
SteveSandersonMS 3df5adb
Fix mistake and add docs on generating baselines
SteveSandersonMS 27534b5
Fix formatting
SteveSandersonMS eaf72c0
Fix baseline for UseWebAssemblyInteractiveAtRoot
SteveSandersonMS 17158d5
Fix baseline for UseServerAndWebAssemblyInteractiveAtRoot
SteveSandersonMS 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 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 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 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: 1 addition & 1 deletion
2
...Sharp/Identity/IdentityRedirectManager.cs → ...onents/Account/IdentityRedirectManager.cs
This file contains 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 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 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 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 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 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 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 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 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 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 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 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 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 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 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 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
File renamed without changes.
This file contains 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 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 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
.../content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/Manage/_Imports.razor
This file contains 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,2 @@ | ||
@layout ManageLayout | ||
@attribute [Microsoft.AspNetCore.Authorization.Authorize] |
This file contains 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 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 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 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
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...mplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Pages/_Imports.razor
This file contains 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,3 @@ | ||
@using BlazorWeb_CSharp.Components.Account.Pages | ||
@using BlazorWeb_CSharp.Components.Account.Shared | ||
@layout AccountLayout |
This file contains 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 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
31 changes: 31 additions & 0 deletions
31
...s/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Components/Account/Shared/AccountLayout.razor
This file contains 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,31 @@ | ||
@inherits LayoutComponentBase | ||
@*#if (UseWebAssembly && InteractiveAtRoot) | ||
@layout BlazorWeb_CSharp.Client.Layout.MainLayout | ||
##else | ||
@layout BlazorWeb_CSharp.Components.Layout.MainLayout | ||
##endif*@ | ||
@inject NavigationManager Nav | ||
|
||
@if (HttpContext is null) | ||
{ | ||
<p>Loading...</p> | ||
} | ||
else | ||
{ | ||
@Body | ||
} | ||
|
||
@code { | ||
[CascadingParameter] HttpContext? HttpContext { get; set; } | ||
|
||
protected override void OnParametersSet() | ||
{ | ||
if (HttpContext is null) | ||
{ | ||
// If this code runs, we're currently rendering in interactive mode, so there is no HttpContext. | ||
// The identity pages need to set cookies, so they require an HttpContext. To achieve this we | ||
// must transition back from interactive mode to a server-rendered page. | ||
Nav.Refresh(forceReload: true); | ||
} | ||
} | ||
} |
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.
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.
We had a bug here before with
Error.razor
being moved into the .Client project if you were using WebAssembly or Auto. To avoid this and future bugs of the same kind, this is now moving individual pages so that newly-added things are not moved by default.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.
To clarify, the projects failed to compile before this fix for
Error.razor
, because the.Client
project can't even referenceHttpContext
(without at least adding a reference toM.A.Http.Abstractions
).