/// <summary>
        /// Get the PrivilegeLevels() needed for accessing a url i.e. appFriendlyName and domain(local/gatekeeper)
        /// as a ordered list
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public List <PrivilegeLevel> GetPrivilegeLevels(string url)
        {
            List <PrivilegeLevel> retVal = new List <PrivilegeLevel>();

            try
            {
                Uri    invokedUrl         = new Uri(url);
                string domain             = invokedUrl.Host + ":" + invokedUrl.Port;
                string moduleFriendlyName = invokedUrl.LocalPath.Split('/').ElementAt(2);

                List <string> privilegeLevels = platform.GetPrivilegeLevels(moduleFriendlyName, domain);


                foreach (string level in Constants.PrivilegeLevels.Keys)
                {
                    if (privilegeLevels.Contains(level))
                    {
                        PrivilegeLevel privilegeLevel = new PrivilegeLevel();
                        privilegeLevel.Name          = level;
                        privilegeLevel.Level         = Constants.PrivilegeLevels[level];
                        privilegeLevel.TokenEndpoint = Constants.PrivilegeLevelTokenEndpoints[level].OriginalString.Replace("DOMAIN", domain);
                        privilegeLevel.TokenEndpoint = privilegeLevel.TokenEndpoint.Replace("<HOMEID>", platform.GetConfSetting("HomeId"));
                        privilegeLevel.TokenEndpoint = privilegeLevel.TokenEndpoint.Replace("<APPCTX>", url);
                        retVal.Add(privilegeLevel);
                    }
                }
            }
            catch (Exception e)
            {
                logger.Log("Exception in Authentication Service at GetPrivilegeLevel for URL " + url + ". Exception: " + e);
            }

            return(retVal);
        }
        /// <summary>
        /// Get the PrivilegeLevels() needed for accessing a url i.e. appFriendlyName and domain(local/gatekeeper) 
        /// as a ordered list
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public List<PrivilegeLevel> GetPrivilegeLevels(string url)
        {
            List<PrivilegeLevel> retVal = new List<PrivilegeLevel>();
            try
            {
                Uri invokedUrl = new Uri(url);
                string domain = invokedUrl.Host + ":" + invokedUrl.Port;
                string moduleFriendlyName = invokedUrl.LocalPath.Split('/').ElementAt(2);

                List<string> privilegeLevels = platform.GetPrivilegeLevels(moduleFriendlyName, domain);


                foreach (string level in Constants.PrivilegeLevels.Keys)
                {
                    if (privilegeLevels.Contains(level))
                    {
                        PrivilegeLevel privilegeLevel = new PrivilegeLevel();
                        privilegeLevel.Name = level;
                        privilegeLevel.Level = Constants.PrivilegeLevels[level];
                        privilegeLevel.TokenEndpoint = Constants.PrivilegeLevelTokenEndpoints[level].OriginalString.Replace("DOMAIN", domain);
                        privilegeLevel.TokenEndpoint = privilegeLevel.TokenEndpoint.Replace("<HOMEID>", platform.GetConfSetting("HomeId"));
                        privilegeLevel.TokenEndpoint = privilegeLevel.TokenEndpoint.Replace("<APPCTX>", url);
                        retVal.Add(privilegeLevel);
                    }
                }
            }
            catch (Exception e)
            {
                logger.Log("Exception in Authentication Service at GetPrivilegeLevel for URL " + url + ". Exception: " + e);
            }

            return retVal;
        }