コード例 #1
0
 /// <summary>
 /// Does the scope exist in the internal list
 /// </summary>
 /// <param name="scope">Scope to look up</param>
 /// <returns></returns>
 public static bool HasScope(string scope)
 {
     foreach (var item in Helix.ScopeMap())
     {
         if (item.scope == scope)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        /// <summary>
        /// Get the scope associated with an endpoint
        /// </summary>
        /// <param name="method">The http method to make the request</param>
        /// <param name="url">Fully qualified endpoint url</param>
        /// <returns>The associated scope</returns>
        public static string GetAssociatedScope(string method, string url)
        {
            string endpoint = GetEndpointUrl(url);

            foreach (var item in Helix.ScopeMap())
            {
                if (item.method == method && item.key == endpoint)
                {
                    return(item.scope);
                }
            }

            return(string.Empty);
        }