//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public java.util.Collection findUserAndRoleDataByQuery(String paramString) throws javax.ejb.EJBException public virtual System.Collections.ICollection findUserAndRoleDataByQuery(string paramString) { LdapLoginUtil ldapLoginUtil = new LdapLoginUtil(Configuration.Options); List <object> arrayList = new List <object>(); try { InitialLdapContext initialLdapContext = ldapLoginUtil.makeLdapInitContext(); SearchControls searchControls = new SearchControls(); searchControls.SearchScope = 2; searchControls.ReturningAttributes = this.attrIDs; searchControls.TimeLimit = 10000; string str1 = Configuration.Options.get("rolesCtxDN").ToString(); string str2 = str1; if (Configuration.Options.get("rolesPlaceCtxDN") != null) { str2 = Configuration.Options.get("rolesPlaceCtxDN").ToString(); } string str3 = "(&(objectclass=person)(|(sAMAccountName=*" + paramString + "*)(name=*" + paramString + "*))(|(memberOf=CN=" + "CESAdmin" + "," + str2 + ")(memberOf=CN=" + "CESDatabaseUser" + "," + str2 + ")))"; NamingEnumeration namingEnumeration = initialLdapContext.search(str1, str3, searchControls); while (namingEnumeration.hasMoreElements()) { arrayList.Add(resultToUserRolesData((SearchResult)namingEnumeration.nextElement(), initialLdapContext, ldapLoginUtil, false)); } initialLdapContext.close(); } catch (Exception exception) { throw new EJBException(exception.Message); } return(arrayList); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public UserAndRolesData getUserAndRoleData(String paramString) throws javax.ejb.EJBException public virtual UserAndRolesData getUserAndRoleData(string paramString) { LdapLoginUtil ldapLoginUtil = new LdapLoginUtil(Configuration.Options); UserAndRolesData userAndRolesData = null; try { InitialLdapContext initialLdapContext = ldapLoginUtil.makeLdapInitContext(); SearchControls searchControls = new SearchControls(); searchControls.SearchScope = 2; searchControls.ReturningAttributes = this.attrIDs; searchControls.TimeLimit = 10000; string str1 = Configuration.Options.get("rolesCtxDN").ToString(); string str2 = "(&(objectclass=person)(sAMAccountName=" + paramString + "))"; NamingEnumeration namingEnumeration = initialLdapContext.search(str1, str2, searchControls); if (namingEnumeration.hasMoreElements()) { userAndRolesData = resultToUserRolesData((SearchResult)namingEnumeration.nextElement(), initialLdapContext, ldapLoginUtil, true); } else { throw new RemoteException(paramString + " was not found, it may have been deleted."); } initialLdapContext.close(); } catch (Exception exception) { Console.WriteLine(exception.ToString()); Console.Write(exception.StackTrace); throw new EJBException(exception.Message); } return(userAndRolesData); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public boolean checkUserExists(String paramString) throws javax.ejb.EJBException public virtual bool checkUserExists(string paramString) { bool @bool = false; LdapLoginUtil ldapLoginUtil = new LdapLoginUtil(Configuration.Options); try { InitialLdapContext initialLdapContext = ldapLoginUtil.makeLdapInitContext(); SearchControls searchControls = new SearchControls(); searchControls.SearchScope = 2; searchControls.ReturningAttributes = new string[0]; searchControls.TimeLimit = 10000; string str1 = Configuration.Options.get("rolesCtxDN").ToString(); string str2 = "(&(objectclass=person)(sAMAccountName=" + paramString + "))"; NamingEnumeration namingEnumeration = initialLdapContext.search(str1, str2, searchControls); if (namingEnumeration.hasMoreElements()) { @bool = true; } namingEnumeration.close(); initialLdapContext.close(); } catch (Exception exception) { throw new EJBException(exception.Message); } return(@bool); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private UserAndRolesData resultToUserRolesData(javax.naming.directory.SearchResult paramSearchResult, javax.naming.ldap.InitialLdapContext paramInitialLdapContext, LdapLoginUtil paramLdapLoginUtil, boolean paramBoolean) throws Exception private UserAndRolesData resultToUserRolesData(SearchResult paramSearchResult, InitialLdapContext paramInitialLdapContext, LdapLoginUtil paramLdapLoginUtil, bool paramBoolean) { UserAndRolesData userAndRolesData = new UserAndRolesData(); PrincipalsData principalsData = new PrincipalsData(); Attributes attributes = paramSearchResult.Attributes; string str1 = StringUtils.getValueFromAttribute(attributes.get("displayName")); string str2 = StringUtils.getValueFromAttribute(attributes.get("description")); string str3 = StringUtils.getValueFromAttribute(attributes.get("sAMAccountName")); string str4 = StringUtils.getValueFromAttribute(attributes.get("userPrincipalName")); if (string.ReferenceEquals(str3, null)) { throw new Exception("sAMAccountName not found for: " + paramSearchResult.Name); } if (string.ReferenceEquals(str1, null)) { str1 = str3; } if (string.ReferenceEquals(str4, null)) { str4 = ""; } principalsData.Name = str1; principalsData.EMail = str4; principalsData.PrincipalId = str3; principalsData.Password = "******"; userAndRolesData.PrincipalsData = principalsData; if (!paramBoolean) { userAndRolesData.RolesData = new RolesData[0]; } else { SearchControls searchControls = new SearchControls(); searchControls.SearchScope = 2; searchControls.ReturningAttributes = this.attrIDs; searchControls.TimeLimit = 10000; string str5 = str3 + "," + Configuration.Options.get("baseCtxDN"); string str6 = (string)Configuration.Options.get("roleRecursion"); int i = 0; try { i = int.Parse(str6); } catch (Exception) { i = 0; } System.Collections.IList list = paramLdapLoginUtil.findRolesOfUser(paramInitialLdapContext, searchControls, str3, str5, i, 0); List <object> arrayList = new List <object>(list.Count); foreach (string str in list) { arrayList.Add(new RolesData(str, str3, str, "Roles")); } userAndRolesData.RolesData = (RolesData[])arrayList.ToArray(typeof(RolesData)); } return(userAndRolesData); }