public static string[] GetUserRoles(string email) { using (var accountApiController = new AccountAPIController()) { var roles = accountApiController.GetUserRoles(email); return(roles); } }
public void Setup() { if (accountAPIController == null) { accountAPIController = new AccountAPIController(); HelperMethods.SetupPostControllerForTest(accountAPIController, "AccountAPI"); } AutoMapperConfig.Configure(); if (RouteTable.Routes.Count == 0) { RouteConfig.RegisterRoutes(RouteTable.Routes); } }
public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal) { if (!incomingPrincipal.Identity.IsAuthenticated) { return(base.Authenticate(resourceName, incomingPrincipal)); } using (var accountApiController = new AccountAPIController()) { var claims = accountApiController.GetUserClaims(incomingPrincipal.Identity.Name); incomingPrincipal.Identities.First().AddClaims(claims); } return(incomingPrincipal); }
public static bool ValidateBasic(string username, string passwordHash) { if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(passwordHash)) { using (var accountApiController = new AccountAPIController()) { var loginModelDTO = accountApiController.GetAccount(username, passwordHash); if (loginModelDTO != null) { return(true); } } } return(false); }