/// <summary>
 /// Checks if the specified scope is allowed in the list of scopes (by string)
 /// </summary>
 public static bool CheckScope(IEnumerable <string> lst, MFBOAuthScope sc)
 {
     if (lst == null)
     {
         return(false);
     }
     return(CheckScope(ScopesFromStrings(lst), sc));
 }
 /// <summary>
 /// Checks if the specified scope is allowed in the space-separated of scopes
 /// </summary>
 public static bool CheckScope(string sz, MFBOAuthScope sc)
 {
     if (String.IsNullOrEmpty(sz))
     {
         return(false);
     }
     return(CheckScope(ScopesFromString(sz), sc));
 }
 /// <summary>
 /// Checks if the specified scope is allowed in the list of scopes
 /// </summary>
 public static bool CheckScope(IEnumerable <MFBOAuthScope> lst, MFBOAuthScope sc)
 {
     if (lst == null)
     {
         return(false);
     }
     return(lst.Contains(sc));
 }
        private void CheckAuth()
        {
            MFBOAuthScope sc = ScopeForService();

            if (!MFBOauthServer.CheckScope(Token.Scope, sc))
            {
                throw new UnauthorizedAccessException(String.Format(CultureInfo.CurrentCulture, "Requested action requires scope \"{0}\", which is not granted.", sc.ToString()));
            }
        }
        /// <summary>
        /// Returns a localized human description of each specified scope
        /// </summary>
        /// <param name="scope"></param>
        /// <returns></returns>
        public static string ScopeDescription(MFBOAuthScope scope)
        {
            switch (scope)
            {
            case MFBOAuthScope.currency:
                return(Resources.oAuth.currencyScopeDescription);

            case MFBOAuthScope.totals:
                return(Resources.oAuth.totalsScopeDescription);

            case MFBOAuthScope.addflight:
                return(Resources.oAuth.addflightScopeDescription);

            case MFBOAuthScope.readflight:
                return(Resources.oAuth.readflightScopeDescription);

            case MFBOAuthScope.addaircraft:
                return(Resources.oAuth.addaircraftScopeDescription);

            case MFBOAuthScope.readaircraft:
                return(Resources.oAuth.readaircraftScopeDescription);

            case MFBOAuthScope.visited:
                return(Resources.oAuth.visitedScopeDescription);

            case MFBOAuthScope.images:
                return(Resources.oAuth.modifyImagesScopeDescription);

            case MFBOAuthScope.namedqueries:
                return(Resources.oAuth.namedqueriesScopeDescription);

            case MFBOAuthScope.none:
                return(string.Empty);

            default:
                throw new ArgumentOutOfRangeException("scope");
            }
        }