Skip to content

Commit 718eda2

Browse files
committed
Fixing information about signout
1 parent fc83c8e commit 718eda2

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

articles/active-directory/develop/scenario-web-app-sign-user-sign-in.md

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,26 @@ During the application registration, you don't need to register an extra logout
240240

241241
# [ASP.NET Core](#tab/aspnetcore)
242242

243-
In ASP.NET Core, the sign-out button is exposed in `Views\Shared\_LoginPartial.cshtml`. It's displayed only when there's an authenticated account. That is, it's displayed when the user has previously signed in.
243+
In ASP.NET, selecting the **Sign out** button in the web app triggers the `SignOut` action on the `AccountController` controller (see below)
244244

245245
```html
246-
@using Microsoft.Identity.Web
247-
@if (User.Identity.IsAuthenticated)
248-
{
249-
<ul class="nav navbar-nav navbar-right">
250-
<li class="navbar-text">Hello @User.GetDisplayName()!</li>
251-
<li><a asp-area="AzureAD" asp-controller="Account" asp-action="SignOut">Sign out</a></li>
252-
</ul>
253-
}
254-
else
255-
{
256-
<ul class="nav navbar-nav navbar-right">
257-
<li><a asp-area="AzureAD" asp-controller="Account" asp-action="SignIn">Sign in</a></li>
258-
</ul>
259-
}
260-
```
246+
<ul class="navbar-nav">
247+
@if (User.Identity.IsAuthenticated)
248+
{
249+
<li class="nav-item">
250+
<span class="navbar-text text-dark">Hello @User.Identity.Name!</span>
251+
</li>
252+
<li class="nav-item">
253+
<a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignOut">Sign out</a>
254+
</li>
255+
}
256+
else
257+
{
258+
<li class="nav-item">
259+
<a class="nav-link text-dark" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignIn">Sign in</a>
260+
</li>
261+
}
262+
</ul>
261263

262264
# [ASP.NET](#tab/aspnet)
263265

@@ -325,15 +327,13 @@ In the Python quickstart, the sign-out button is located in the [templates/index
325327

326328
# [ASP.NET Core](#tab/aspnetcore)
327329

328-
In ASP.NET, selecting the **Sign-out** button in the web app triggers the `SignOut` action on the `AccountController` controller. In previous versions of the ASP.NET Core templates, the `Account` controller was embedded with the web app. That's no longer the case because the controller is now part of the ASP.NET Core framework.
329-
330-
The code for the `AccountController` is available from the ASP.NET core repository in [AccountController.cs](https://github.com/aspnet/AspNetCore/blob/master/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Areas/AzureAD/Controllers/AccountController.cs). The account control:
330+
In previous versions of the ASP.NET core templates, the `Account` controller was embedded with the web app. That's no longer the case because the controller is now part of the **Microsoft.Identity.Web.UI** NuGet package. See [AccountController.cs](https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web.UI/Areas/MicrosoftIdentity/Controllers/AccountController.cs) for details.
331331

332332
- Sets an OpenID redirect URI to `/Account/SignedOut` so that the controller is called back when Azure AD has completed the sign-out.
333333
- Calls `Signout()`, which lets the OpenID Connect middleware contact the Microsoft identity platform `logout` endpoint. The endpoint then:
334334

335335
- Clears the session cookie from the browser.
336-
- Calls back the logout URL. By default, the logout URL displays the signed-out view page [SignedOut.html](https://github.com/aspnet/AspNetCore/blob/master/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Areas/AzureAD/Pages/Account/SignedOut.cshtml). This page is also provided as part of ASP.NET Core.
336+
- Calls back the logout URL. By default, the logout URL displays the signed-out view page [SignedOut.html](https://github.com/aspnet/AspNetCore/blob/master/src/Azure/AzureAD/Authentication.AzureAD.UI/src/Areas/AzureAD/Pages/Account/SignedOut.cshtml). This page is also provided as part of MIcrosoft.Identity.Web.
337337

338338
# [ASP.NET](#tab/aspnet)
339339

@@ -395,15 +395,7 @@ The post-logout URI enables applications to participate in the global sign-out.
395395

396396
# [ASP.NET Core](#tab/aspnetcore)
397397

398-
The ASP.NET Core OpenID Connect middleware enables your app to intercept the call to the Microsoft identity platform `logout` endpoint by providing an OpenID Connect event named `OnRedirectToIdentityProviderForSignOut`. For an example of how to subscribe to this event (to clear the token cache), see [Microsoft.Identity.Web/WebAppServiceCollectionExtensions.cs#L151-L156](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/faa94fd49c2da46b22d6694c4f5c5895795af26d/Microsoft.Identity.Web/WebAppServiceCollectionExtensions.cs#L151-L156).
399-
400-
```csharp
401-
// Handling the global sign-out
402-
options.Events.OnRedirectToIdentityProviderForSignOut = async context =>
403-
{
404-
// Forget about the signed-in user
405-
};
406-
```
398+
The ASP.NET Core OpenID Connect middleware enables your app to intercept the call to the Microsoft identity platform `logout` endpoint by providing an OpenID Connect event named `OnRedirectToIdentityProviderForSignOut`. This is handled automatically by Microsoft.Identity.Web (which clears accounts in the case where your web app calls web apis)
407399

408400
# [ASP.NET](#tab/aspnet)
409401

0 commit comments

Comments
 (0)