Exemplo n.º 1
0
 public BenchmarkTask(string name, EncodeAction encodeAction, DecodeAction decodeAction)
 {
     Name = name;
     EncodeAction = encodeAction;
     DecodeAction = decodeAction;
 }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private boolean createLdapInitContext(String paramString, Object paramObject) throws Exception
        private bool createLdapInitContext(string paramString, object paramObject)
        {
            this.bindDN         = (string)this.options.get("bindDN");
            this.bindCredential = (string)this.options.get("bindCredential");
            string str1 = (string)this.options.get("jaasSecurityDomain");

            if (!string.ReferenceEquals(str1, null))
            {
                ObjectName objectName  = new ObjectName(str1);
                char[]     arrayOfChar = DecodeAction.decode(this.bindCredential, objectName);
                this.bindCredential = new string(arrayOfChar);
            }
            this.baseDN          = (string)this.options.get("baseCtxDN");
            this.baseFilter      = (string)this.options.get("baseFilter");
            this.roleFilter      = (string)this.options.get("roleFilter");
            this.roleAttributeID = (string)this.options.get("roleAttributeID");
            if (string.ReferenceEquals(this.roleAttributeID, null))
            {
                this.roleAttributeID = "role";
            }
            string str2 = (string)this.options.get("roleAttributeIsDN");

            this.roleAttributeIsDN   = Convert.ToBoolean(str2);
            this.roleNameAttributeID = (string)this.options.get("roleNameAttributeID");
            if (string.ReferenceEquals(this.roleNameAttributeID, null))
            {
                this.roleNameAttributeID = "name";
            }
            string str3 = (string)this.options.get("parseRoleNameFromDN");

            this.parseRoleNameFromDN = Convert.ToBoolean(str3);
            this.rolesCtxDN          = (string)this.options.get("rolesCtxDN");
            string str4 = (string)this.options.get("roleRecursion");

            try
            {
                this.recursion = int.Parse(str4);
            }
            catch (Exception)
            {
                if (this.trace)
                {
                    this.log.trace("Failed to parse: " + str4 + ", disabling recursion");
                }
                this.recursion = 0;
            }
            string str5 = (string)this.options.get("searchTimeLimit");

            if (!string.ReferenceEquals(str5, null))
            {
                try
                {
                    this.searchTimeLimit = int.Parse(str5);
                }
                catch (System.FormatException)
                {
                    if (this.trace)
                    {
                        this.log.trace("Failed to parse: " + str5 + ", using searchTimeLimit=" + this.searchTimeLimit);
                    }
                }
            }
            string str6 = (string)this.options.get("searchScope");

            if ("OBJECT_SCOPE".Equals(str6, StringComparison.OrdinalIgnoreCase))
            {
                this.searchScope = 0;
            }
            else if ("ONELEVEL_SCOPE".Equals(str6, StringComparison.OrdinalIgnoreCase))
            {
                this.searchScope = 1;
            }
            if ("SUBTREE_SCOPE".Equals(str6, StringComparison.OrdinalIgnoreCase))
            {
                this.searchScope = 2;
            }
            initialLdapContext = null;
            try
            {
                initialLdapContext = constructInitialLdapContext(this.bindDN, this.bindCredential);
                string         str            = bindDNAuthentication(initialLdapContext, paramString, paramObject, this.baseDN, this.baseFilter);
                SearchControls searchControls = new SearchControls();
                searchControls.SearchScope         = this.searchScope;
                searchControls.ReturningAttributes = new string[0];
                searchControls.TimeLimit           = this.searchTimeLimit;
                rolesSearch(initialLdapContext, searchControls, paramString, str, this.recursion, 0);
            }
            finally
            {
                if (initialLdapContext != null)
                {
                    initialLdapContext.close();
                }
            }
            return(true);
        }