Use WindowsPrincipal everywhere

This commit is contained in:
Pranav K 2016-10-28 14:54:57 -07:00
parent f70313c17a
commit d864418083
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Security.Claims;
using System.Security.Principal;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
@ -109,8 +110,7 @@ namespace MusicStore
// administrator. But this can be changed to suit the needs.
var identity = (ClaimsIdentity)context.User.Identity;
if (context.User.Identity.Name == Environment.GetEnvironmentVariable("USERDOMAIN") + "\\"
+ Environment.GetEnvironmentVariable("USERNAME"))
if (context.User.Identity.Name == WindowsPrincipal.Current.Identity.Name)
{
identity.AddClaim(new Claim("ManageStore", "Allowed"));
}