public bool UserIsInRole(string employerAccountId, EmployerUserRole userRole, IEnumerable <Claim> claims)
        {
            try
            {
                var accountsClaim      = claims.First(c => c.Type == EmployerClaims.AccountsClaimsTypeIdentifier);
                var employerAccounts   = JsonConvert.DeserializeObject <Dictionary <string, EmployerIdentifier> >(accountsClaim.Value);
                var employerIdentifier = employerAccounts[employerAccountId];

                return(employerIdentifier.Role == userRole.ToString());
            }
            catch (Exception e)
            {
                _logger.LogError(e, "Error while trying to assert employer user role.");
                return(false);
            }
        }
        private IEnumerable <Claim> BuildClaims(string employerAccountId, EmployerUserRole userRole)
        {
            var claims = new List <Claim>
            {
                new Claim(EmployerClaims.AccountsClaimsTypeIdentifier,
                          JsonConvert.SerializeObject(
                              new Dictionary <string, EmployerIdentifier>
                {
                    {
                        employerAccountId, new EmployerIdentifier
                        {
                            AccountId    = employerAccountId,
                            EmployerName = "Tests That Pass",
                            Role         = userRole.ToString()
                        }
                    }
                }
                              ))
            };

            return(claims);
        }