|
@ -2,26 +2,24 @@ |
|
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
|
|
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using Identity.API.Models; |
|
|
|
|
|
using Identity.API.Models.AccountViewModels; |
|
|
|
|
|
using Identity.API.Services; |
|
|
using IdentityModel; |
|
|
using IdentityModel; |
|
|
using IdentityServer4.Quickstart.UI.Models; |
|
|
|
|
|
|
|
|
using IdentityServer4.Models; |
|
|
using IdentityServer4.Services; |
|
|
using IdentityServer4.Services; |
|
|
using Microsoft.AspNetCore.Http.Authentication; |
|
|
|
|
|
|
|
|
using IdentityServer4.Stores; |
|
|
|
|
|
using Microsoft.AspNetCore.Authentication; |
|
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
|
|
using Microsoft.AspNetCore.Identity; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Security.Claims; |
|
|
using System.Security.Claims; |
|
|
using System.Text.Encodings.Web; |
|
|
using System.Text.Encodings.Web; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using IdentityServer4.Models; |
|
|
|
|
|
using IdentityServer4.Stores; |
|
|
|
|
|
using Identity.API.Services; |
|
|
|
|
|
using Identity.API.Models; |
|
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
|
|
using Identity.API.Models.AccountViewModels; |
|
|
|
|
|
using Microsoft.AspNetCore.Identity; |
|
|
|
|
|
using Microsoft.AspNetCore.Authentication; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace IdentityServer4.Quickstart.UI.Controllers |
|
|
namespace IdentityServer4.Quickstart.UI.Controllers |
|
|
{ |
|
|
{ |
|
@ -194,7 +192,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
// hack: try/catch to handle social providers that throw
|
|
|
// hack: try/catch to handle social providers that throw
|
|
|
await HttpContext.Authentication.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url }); |
|
|
|
|
|
|
|
|
await HttpContext.SignOutAsync(idp, new AuthenticationProperties { RedirectUri = url }); |
|
|
} |
|
|
} |
|
|
catch(Exception ex) |
|
|
catch(Exception ex) |
|
|
{ |
|
|
{ |
|
@ -203,7 +201,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// delete authentication cookie
|
|
|
// delete authentication cookie
|
|
|
await HttpContext.Authentication.SignOutAsync(); |
|
|
|
|
|
|
|
|
await HttpContext.SignOutAsync(); |
|
|
|
|
|
|
|
|
// set this so UI rendering sees an anonymous user
|
|
|
// set this so UI rendering sees an anonymous user
|
|
|
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); |
|
|
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); |
|
@ -217,7 +215,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers |
|
|
public async Task<IActionResult> DeviceLogOut(string redirectUrl) |
|
|
public async Task<IActionResult> DeviceLogOut(string redirectUrl) |
|
|
{ |
|
|
{ |
|
|
// delete authentication cookie
|
|
|
// delete authentication cookie
|
|
|
await HttpContext.Authentication.SignOutAsync(); |
|
|
|
|
|
|
|
|
await HttpContext.SignOutAsync(); |
|
|
|
|
|
|
|
|
// set this so UI rendering sees an anonymous user
|
|
|
// set this so UI rendering sees an anonymous user
|
|
|
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); |
|
|
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity()); |
|
|