Remove unused external logins classes
This commit is contained in:
parent
23992ed324
commit
0105808354
@ -20,7 +20,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
|
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This sample controller implements a typical login/logout/provision workflow for local and external accounts.
|
/// This sample controller implements a typical login/logout/provision workflow for local accounts.
|
||||||
/// The login service encapsulates the interactions with the user data store. This data store is in-memory only and cannot be used for production!
|
/// The login service encapsulates the interactions with the user data store. This data store is in-memory only and cannot be used for production!
|
||||||
/// The interaction service provides a way for the UI to communicate with identityserver for validation and context retrieval
|
/// The interaction service provides a way for the UI to communicate with identityserver for validation and context retrieval
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -58,8 +58,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
|
|||||||
var context = await _interaction.GetAuthorizationContextAsync(returnUrl);
|
var context = await _interaction.GetAuthorizationContextAsync(returnUrl);
|
||||||
if (context?.IdP != null)
|
if (context?.IdP != null)
|
||||||
{
|
{
|
||||||
// if IdP is passed, then bypass showing the login screen
|
throw new NotImplementedException("External login is not implemented!");
|
||||||
return ExternalLogin(context.IdP, returnUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var vm = await BuildLoginViewModelAsync(returnUrl, context);
|
var vm = await BuildLoginViewModelAsync(returnUrl, context);
|
||||||
@ -209,7 +208,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogCritical(ex.Message);
|
_logger.LogError(ex, "LOGOUT ERROR: {ExceptionMessage}", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,28 +237,6 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
|
|||||||
return Redirect(redirectUrl);
|
return Redirect(redirectUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// initiate roundtrip to external authentication provider
|
|
||||||
/// </summary>
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult ExternalLogin(string provider, string returnUrl)
|
|
||||||
{
|
|
||||||
if (returnUrl != null)
|
|
||||||
{
|
|
||||||
returnUrl = UrlEncoder.Default.Encode(returnUrl);
|
|
||||||
}
|
|
||||||
returnUrl = "/account/externallogincallback?returnUrl=" + returnUrl;
|
|
||||||
|
|
||||||
// start challenge and roundtrip the return URL
|
|
||||||
var props = new AuthenticationProperties
|
|
||||||
{
|
|
||||||
RedirectUri = returnUrl,
|
|
||||||
Items = { { "scheme", provider } }
|
|
||||||
};
|
|
||||||
return new ChallengeResult(provider, props);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// GET: /Account/Register
|
// GET: /Account/Register
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.AccountViewModels
|
|
||||||
{
|
|
||||||
public class ExternalLoginConfirmationViewModel
|
|
||||||
{
|
|
||||||
[Required]
|
|
||||||
[EmailAddress]
|
|
||||||
public string Email { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Http.Authentication;
|
|
||||||
using Microsoft.AspNetCore.Identity;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
|
||||||
{
|
|
||||||
public class ManageLoginsViewModel
|
|
||||||
{
|
|
||||||
public IList<UserLoginInfo> CurrentLogins { get; set; }
|
|
||||||
|
|
||||||
public IList<AuthenticationDescription> OtherLogins { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
namespace Microsoft.eShopOnContainers.Services.Identity.API.Models.ManageViewModels
|
|
||||||
{
|
|
||||||
public class RemoveLoginViewModel
|
|
||||||
{
|
|
||||||
public string LoginProvider { get; set; }
|
|
||||||
public string ProviderKey { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,7 +16,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
public async Task<IActionResult> SignIn(string returnUrl)
|
public async Task<IActionResult> SignIn(string returnUrl)
|
||||||
{
|
{
|
||||||
var user = User as ClaimsPrincipal;
|
var user = User as ClaimsPrincipal;
|
||||||
|
|
||||||
var token = await HttpContext.GetTokenAsync("access_token");
|
var token = await HttpContext.GetTokenAsync("access_token");
|
||||||
|
|
||||||
if (token != null)
|
if (token != null)
|
||||||
@ -33,11 +33,11 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
{
|
{
|
||||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||||
await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
|
await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
|
||||||
|
|
||||||
// "Catalog" because UrlHelper doesn't support nameof() for controllers
|
// "Catalog" because UrlHelper doesn't support nameof() for controllers
|
||||||
// https://github.com/aspnet/Mvc/issues/5853
|
// https://github.com/aspnet/Mvc/issues/5853
|
||||||
var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog");
|
var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog");
|
||||||
return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme,
|
return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme,
|
||||||
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
|
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user