File tree 5 files changed +33
-19
lines changed
9.0/BlazorWebAppWinAuthServer
5 files changed +33
-19
lines changed Original file line number Diff line number Diff line change
1
+ @inject NavigationManager Navigation
2
+
3
+ @code {
4
+ protected override void OnInitialized ()
5
+ {
6
+ Navigation .Refresh (forceReload : true );
7
+ }
8
+ }
Original file line number Diff line number Diff line change 20
20
</NavLink >
21
21
</div >
22
22
23
- <AuthorizeView >
24
- <div class =" nav-item px-3" >
25
- <NavLink class =" nav-link" href =" weather" >
26
- <span class =" bi bi-list-nested-nav-menu" aria-hidden =" true" ></span > Weather
27
- </NavLink >
28
- </div >
23
+ <div class =" nav-item px-3" >
24
+ <NavLink class =" nav-link" href =" weather" >
25
+ <span class =" bi bi-list-nested-nav-menu" aria-hidden =" true" ></span > Weather (Secure)
26
+ </NavLink >
27
+ </div >
29
28
30
- <div class =" nav-item px-3" >
31
- <NavLink class =" nav-link" href =" user-claims" >
32
- <span class =" bi bi-list-nested-nav-menu" aria-hidden =" true" ></span > User Claims
33
- </NavLink >
34
- </div >
29
+ <div class =" nav-item px-3" >
30
+ <NavLink class =" nav-link" href =" user-claims" >
31
+ <span class =" bi bi-list-nested-nav-menu" aria-hidden =" true" ></span > User Claims (Secure)
32
+ </NavLink >
33
+ </div >
35
34
36
- <div class =" nav-item px-3" >
37
- <NavLink class =" nav-link" href =" local-account-only" >
38
- <span class =" bi bi-list-nested-nav-menu" aria-hidden =" true" ></span > Local Account Only
39
- </NavLink >
40
- </div >
41
- </AuthorizeView >
35
+ <div class =" nav-item px-3" >
36
+ <NavLink class =" nav-link" href =" local-account" >
37
+ <span class =" bi bi-list-nested-nav-menu" aria-hidden =" true" ></span > Local Account (Secure)
38
+ </NavLink >
39
+ </div >
42
40
</nav >
43
41
</div >
44
42
Original file line number Diff line number Diff line change 1
- @page " /local-account-only "
1
+ @page " /local-account"
2
2
@using Microsoft .AspNetCore .Authorization
3
3
@attribute [Authorize("LocalAccount")]
4
4
Original file line number Diff line number Diff line change 1
1
<Router AppAssembly =" typeof(Program).Assembly" >
2
2
<Found Context =" routeData" >
3
- <AuthorizeRouteView RouteData =" routeData" DefaultLayout =" typeof(Layout.MainLayout)" />
3
+ <AuthorizeRouteView RouteData =" routeData" DefaultLayout =" typeof(Layout.MainLayout)" >
4
+ <NotAuthorized >
5
+ <ForceLogin />
6
+ </NotAuthorized >
7
+ </AuthorizeRouteView >
4
8
<FocusOnNavigate RouteData =" routeData" Selector =" h1" />
5
9
</Found >
6
10
</Router >
Original file line number Diff line number Diff line change 7
7
builder . Services . AddAuthentication ( NegotiateDefaults . AuthenticationScheme )
8
8
. AddNegotiate ( ) ;
9
9
10
+ // To require authentication for all users for the
11
+ // entire app, use the following code.
12
+ /*
10
13
builder.Services.AddAuthorization(options =>
11
14
{
12
15
options.FallbackPolicy = options.DefaultPolicy;
13
16
});
17
+ */
14
18
15
19
builder . Services . AddCascadingAuthenticationState ( ) ;
16
20
You can’t perform that action at this time.
0 commit comments