Skip to content

Commit 0105808

Browse files
committed
Remove unused external logins classes
1 parent 23992ed commit 0105808

5 files changed

Lines changed: 6 additions & 61 deletions

File tree

src/Services/Identity/Identity.API/Controllers/AccountController.cs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
namespace Microsoft.eShopOnContainers.Services.Identity.API.Controllers
2121
{
2222
/// <summary>
23-
/// This sample controller implements a typical login/logout/provision workflow for local and external accounts.
23+
/// This sample controller implements a typical login/logout/provision workflow for local accounts.
2424
/// The login service encapsulates the interactions with the user data store. This data store is in-memory only and cannot be used for production!
2525
/// The interaction service provides a way for the UI to communicate with identityserver for validation and context retrieval
2626
/// </summary>
@@ -58,8 +58,7 @@ public async Task<IActionResult> Login(string returnUrl)
5858
var context = await _interaction.GetAuthorizationContextAsync(returnUrl);
5959
if (context?.IdP != null)
6060
{
61-
// if IdP is passed, then bypass showing the login screen
62-
return ExternalLogin(context.IdP, returnUrl);
61+
throw new NotImplementedException("External login is not implemented!");
6362
}
6463

6564
var vm = await BuildLoginViewModelAsync(returnUrl, context);
@@ -209,7 +208,7 @@ public async Task<IActionResult> Logout(LogoutViewModel model)
209208
}
210209
catch (Exception ex)
211210
{
212-
_logger.LogCritical(ex.Message);
211+
_logger.LogError(ex, "LOGOUT ERROR: {ExceptionMessage}", ex.Message);
213212
}
214213
}
215214

@@ -238,28 +237,6 @@ public async Task<IActionResult> DeviceLogOut(string redirectUrl)
238237
return Redirect(redirectUrl);
239238
}
240239

241-
/// <summary>
242-
/// initiate roundtrip to external authentication provider
243-
/// </summary>
244-
[HttpGet]
245-
public IActionResult ExternalLogin(string provider, string returnUrl)
246-
{
247-
if (returnUrl != null)
248-
{
249-
returnUrl = UrlEncoder.Default.Encode(returnUrl);
250-
}
251-
returnUrl = "/account/externallogincallback?returnUrl=" + returnUrl;
252-
253-
// start challenge and roundtrip the return URL
254-
var props = new AuthenticationProperties
255-
{
256-
RedirectUri = returnUrl,
257-
Items = { { "scheme", provider } }
258-
};
259-
return new ChallengeResult(provider, props);
260-
}
261-
262-
263240
// GET: /Account/Register
264241
[HttpGet]
265242
[AllowAnonymous]

src/Services/Identity/Identity.API/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Services/Identity/Identity.API/Models/ManageViewModels/ManageLoginsViewModel.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/Services/Identity/Identity.API/Models/ManageViewModels/RemoveLoginViewModel.cs

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/Web/WebMVC/Controllers/AccountController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class AccountController : Controller
1616
public async Task<IActionResult> SignIn(string returnUrl)
1717
{
1818
var user = User as ClaimsPrincipal;
19-
19+
2020
var token = await HttpContext.GetTokenAsync("access_token");
2121

2222
if (token != null)
@@ -33,11 +33,11 @@ public async Task<IActionResult> Signout()
3333
{
3434
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
3535
await HttpContext.SignOutAsync(OpenIdConnectDefaults.AuthenticationScheme);
36-
36+
3737
// "Catalog" because UrlHelper doesn't support nameof() for controllers
3838
// https://github.com/aspnet/Mvc/issues/5853
3939
var homeUrl = Url.Action(nameof(CatalogController.Index), "Catalog");
40-
return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme,
40+
return new SignOutResult(OpenIdConnectDefaults.AuthenticationScheme,
4141
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
4242
}
4343
}

0 commit comments

Comments
 (0)