diff --git a/src/MusicStore/Controllers/AccountController.cs b/src/MusicStore/Controllers/AccountController.cs index 10837baefd..f21e14c984 100644 --- a/src/MusicStore/Controllers/AccountController.cs +++ b/src/MusicStore/Controllers/AccountController.cs @@ -1,6 +1,4 @@ -using System; -using System.Security.Claims; -using Microsoft.AspNet.Identity; +using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.Security; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.ModelBinding; @@ -209,64 +207,4 @@ namespace MusicStore.Controllers #endregion } - - /// - /// TODO: Temporary APIs to unblock build. Need to remove this once we have these APIs available. - /// - public static class Extensions - { - /// - /// Return the user name using the UserNameClaimType - /// - /// - /// - public static string GetUserName(this IIdentity identity) - { - if (identity == null) - { - throw new ArgumentNullException("identity"); - } - var ci = identity as ClaimsIdentity; - if (ci != null) - { - return ci.FindFirstValue(ClaimsIdentity.DefaultNameClaimType); - } - return null; - } - - /// - /// Return the user id using the UserIdClaimType - /// - /// - /// - public static string GetUserId(this IIdentity identity) - { - if (identity == null) - { - throw new ArgumentNullException("identity"); - } - var ci = identity as ClaimsIdentity; - if (ci != null) - { - return ci.FindFirstValue(ClaimTypes.NameIdentifier); - } - return null; - } - - /// - /// Return the claim value for the first claim with the specified type if it exists, null otherwise - /// - /// - /// - /// - public static string FindFirstValue(this ClaimsIdentity identity, string claimType) - { - if (identity == null) - { - throw new ArgumentNullException("identity"); - } - var claim = identity.FindFirst(claimType); - return claim != null ? claim.Value : null; - } - } } \ No newline at end of file diff --git a/src/MusicStore/Controllers/CheckoutController.cs b/src/MusicStore/Controllers/CheckoutController.cs index 922749dd43..0ab123cacb 100644 --- a/src/MusicStore/Controllers/CheckoutController.cs +++ b/src/MusicStore/Controllers/CheckoutController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNet.Mvc; +using System.Security.Principal; +using Microsoft.AspNet.Mvc; using MusicStore.Models; using System; using System.Linq; diff --git a/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml b/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml index 1b0a3833a5..54e7cd295a 100644 --- a/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml +++ b/src/MusicStore/Views/Account/_ChangePasswordPartial.cshtml @@ -1,5 +1,4 @@ -@*This using statement to MusicStore.Controllers should go away once we have the GetUserName() extension on IIdentity in some Identity package*@ -@using MusicStore.Controllers +@using System.Security.Principal @model MusicStore.Models.ManageUserViewModel

You're logged in as @Context.HttpContext.User.Identity.GetUserName().

diff --git a/src/MusicStore/Views/Shared/_LoginPartial.cshtml b/src/MusicStore/Views/Shared/_LoginPartial.cshtml index 31e33e84ed..9d5c3cf717 100644 --- a/src/MusicStore/Views/Shared/_LoginPartial.cshtml +++ b/src/MusicStore/Views/Shared/_LoginPartial.cshtml @@ -1,6 +1,4 @@ -@*This using statement to MusicStore.Controllers should go away once we have the GetUserName() extension on IIdentity in some Identity package*@ -@using MusicStore.Controllers -@using Microsoft.AspNet.Identity; +@using System.Security.Principal @if (Context.HttpContext.User != null && Context.HttpContext.User.Identity.IsAuthenticated) {