Skip to content

Commit 3714da6

Browse files
authored
Updates
1 parent f0ded2c commit 3714da6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

aspnetcore/blazor/security/blazor-web-app-with-oidc.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,19 +620,15 @@ The <xref:Microsoft.AspNetCore.Builder.AuthorizationEndpointConventionBuilderExt
620620

621621
:::zone-end
622622

623-
## Redirect to the home page on signout
623+
## Redirect to the home page on logout
624624

625-
When a user navigates around the app, the `LogInOrOut` component (`Layout/LogInOrOut.razor`) sets a hidden field for the return URL (`ReturnUrl`) to the value of the current URL (`currentURL`). When the user signs out of the app, the identity provider returns them to the page from which they signed out.
625+
The `LogInOrOut` component (`Layout/LogInOrOut.razor`) sets a hidden field for the return URL (`ReturnUrl`) to the current URL (`currentURL`). When the user signs out of the app, the identity provider returns the user to the page from which they logged out. If the user logs out from a secure page, they're returned to the same secure page and sent back through the authentication process. This authentication flow is reasonable when users need to change accounts regularly.
626626

627-
If the user signs out from a secure page, they're returned back to the same secure page after signing out only to be sent back through the authentication process. This behavior is fine when users need to switch accounts frequently. However, a alternative app specification may call for the user to be returned to the app's home page or some other page after signout. The following example shows how to set the app's home page as the return URL for signout operations.
628-
629-
The important changes to the `LogInOrOut` component are demonstrated in the following example. There's no need to provide a hidden field for the `ReturnUrl` set to the home page at `/` because that's the default path. <xref:System.IDisposable> is no longer implemented. The <xref:Microsoft.AspNetCore.Components.NavigationManager> is no longer injected. The entire `@code` block is removed.
627+
Alternatively, use the following `LogInOrOut` component, which doesn't supply a return URL when logging out.
630628

631629
`Layout/LogInOrOut.razor`:
632630

633631
```razor
634-
@using Microsoft.AspNetCore.Authorization
635-
636632
<div class="nav-item px-3">
637633
<AuthorizeView>
638634
<Authorized>

0 commit comments

Comments
 (0)