Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                password.SetPackagePolicy(PanelSecurity.PackageId, UserSettings.EXCHANGE_POLICY, "MailboxPasswordPolicy");

                PasswordPolicyResult passwordPolicy = ES.Services.Organizations.GetPasswordPolicy(PanelRequest.ItemID);
                if (passwordPolicy.IsSuccess)
                {
                    password.MinimumLength = passwordPolicy.Value.MinLength;
                    if (passwordPolicy.Value.IsComplexityEnable)
                    {
                        password.MinimumNumbers   = 1;
                        password.MinimumSymbols   = 1;
                        password.MinimumUppercase = 1;
                    }
                }
                else
                {
                    messageBox.ShowMessage(passwordPolicy, "CREATE_ORGANIZATION_USER", "HostedOrganization");
                }

                PackageInfo package = ES.Services.Packages.GetPackage(PanelSecurity.PackageId);
                if (package != null)
                {
                    UserInfo user = ES.Services.Users.GetUserById(package.UserId);
                    if (user != null)
                    {
                        sendInstructionEmail.Text = user.Email;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public virtual Response checkPassword(PasswordDto password)
        {
            bool isEnabled = processEngine.ProcessEngineConfiguration.EnablePasswordPolicy;

            if (isEnabled)
            {
                IdentityService identityService = processEngine.IdentityService;

                PasswordPolicyResult result = identityService.checkPasswordAgainstPolicy(password.Password);

                return(Response.status(Response.Status.OK.StatusCode).entity(CheckPasswordPolicyResultDto.fromPasswordPolicyResult(result)).build());
            }
            else
            {
                return(Response.status(Response.Status.NOT_FOUND.StatusCode).build());
            }
        }
        internal PasswordPolicyResult GetPasswordPolicyInternal()
        {
            HostedSolutionLog.LogStart("GetPasswordPolicyInternal");

            PasswordPolicyResult res = new PasswordPolicyResult { IsSuccess = true };

            string[] policyAttributes = new[] {"minPwdLength", 
                                               "pwdProperties", 
                                               "objectClass"};
            try
            {
                DirectoryEntry domainRoot = new DirectoryEntry(ActiveDirectoryUtils.ConvertDomainName(RootDomain));

                DirectorySearcher ds = new DirectorySearcher(
                    domainRoot,
                    "(objectClass=domainDNS)",
                    policyAttributes,
                    SearchScope.Base
                    );


                SearchResult result = ds.FindOne();

                PasswordPolicy ret = new PasswordPolicy
                {
                    MinLength = ((int)result.Properties["minPwdLength"][0]),
                    IsComplexityEnable = ((int)result.Properties["pwdProperties"][0] == 1)
                };
                res.Value = ret;
            }
            catch (Exception ex)
            {
                HostedSolutionLog.LogError(ex);
                res.IsSuccess = false;
                res.ErrorCodes.Add(ErrorCodes.CANNOT_GET_PASSWORD_COMPLEXITY);
            }

            HostedSolutionLog.LogEnd("GetPasswordPolicyInternal");
            return res;
        }
        public static PasswordPolicyResult GetPasswordPolicy(int itemId)
        {
            PasswordPolicyResult res = new PasswordPolicyResult {IsSuccess = true};
            try
            {
                Organization org = GetOrganization(itemId);
                if (org == null)
                {
                    res.IsSuccess = false;
                    res.ErrorCodes.Add(ErrorCodes.CANNOT_GET_ORGANIZATION_BY_ITEM_ID);
                    return res;
                }

                Organizations orgProxy;
                try
                {
                    orgProxy = GetOrganizationProxy(org.ServiceId);
                }
                catch(Exception ex)
                {
                    res.IsSuccess = false;
                    res.ErrorCodes.Add(ErrorCodes.CANNOT_GET_ORGANIZATION_PROXY);
                    TaskManager.WriteError(ex);
                    return res;
                }

                 PasswordPolicyResult policyRes = orgProxy.GetPasswordPolicy();                
                 res.ErrorCodes.AddRange(policyRes.ErrorCodes);
                 if (!policyRes.IsSuccess)
                 {
                     res.IsSuccess = false;
                     return res;
                 }
                
                res.Value = policyRes.Value;
            }
            catch(Exception ex)
            {
                TaskManager.WriteError(ex);
            }
            return res;
        }