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.
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
BWA with WinAuth article #34708
BWA with WinAuth article #34708
Changes from all commits
51167ed
673e3de
86bf3b7
f572ef7
85c3570
25dcfcd
72621fd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
What's the point of this attribute given that this sample also uses
options.FallbackPolicy = options.DefaultPolicy
?I'd sooner remove the fallback policy part than this attribute though. I find too many people set the fallback policy to the default policy not realizing it makes
[Authorize]
redundant.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.
The presence of the attribute is merely an oversight. However, I just ran into a pre-rendering/rendering problem removing the fallback policy:
TL;DR ☝️😆 ... I don't know how to make this sample work without the fallback policy that requires all users to authenticate as soon as the app starts.
Sample App: https://github.com/dotnet/blazor-samples/tree/main/9.0/BlazorWebAppWinAuthServer
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 think the sample would need a
RedirectToLogin
like the OIDC sample has here. It would probably best to call it something likeForceLogin
even though, and I think you could get away with having the component just callNavigationManager.Refresh(forceReload: true)
rather than hit the "authentication/login" minimal endpoint and redirect back, so it would be even simpler. The new top-level request induced byRefresh
should be enough for the authorization middleware issue a challenge via the Windows authentication handler (NegotiateHandler
).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.
Thx @halter73 ... I'll give that a shot on Monday morning. Have a great weekend! 🍻
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.
@halter73 ... I made the updates on https://github.com/dotnet/blazor-samples/pull/478/files.
Sample: https://github.com/dotnet/blazor-samples/tree/main/9.0/BlazorWebAppWinAuthServer
No 🎲🎲 yet ... Try to access a secure page, it presents the Windows Security signin popup, and then it puts the app/page into a redirect loop of death 💀 immediately after signing in.
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.
Ping @halter73 ... Made the changes that you recommended ☝️ ... but it puts the app into a redirect death loop.
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.
Does this happen even if you navigate directly to the secure page from the address bar? And does it happen after signing in successfully? I'm surprised that the
<NotAuthorized>
logic would reexecute after that.I'll probably have to try the sample out myself to debug it. It might be a few days before I can get to it.
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.
You don't get a chance to do that under this scenario. The app loads the homepage with anonymous access. You navigate to a secure page ... sign in ... and then the authorized page loads, but it loads in a 💀 redirect loop, flashing it's content over and over rapidly.
Yes, that's when it happens.