private PolicyComplexity PreparePolicyComplexityObject(IAuthenticationResponse authenticationResponse) { var policyResponseObject = JsonConvert.SerializeObject(authenticationResponse.Embedded["policy"]); dynamic policyComplexityObj = JsonConvert.DeserializeObject <dynamic>(policyResponseObject).complexity; string passwordComplexityString = JsonConvert.SerializeObject(policyComplexityObj); PolicyComplexity passwordComplexityObj = JsonConvert.DeserializeObject <PolicyComplexity>(passwordComplexityString); return(passwordComplexityObj); }
private void AssignPolicyComplexityObj(PolicyComplexity passwordComplexity) { this.policyComplexity = passwordComplexity; }
/// <summary> /// The ProcessAuthnResponse /// </summary> /// <param name="authenticationResponse">The authenticationResponse<see cref="IAuthenticationResponse"/></param> public void ProcessAuthnResponse(IAuthenticationResponse authenticationResponse) { // this.logger.Debug("ProcessAuthnResponse sessionToken: " + authenticationResponse.SessionToken); this.AuthenticationResponse = (AuthenticationResponse)authenticationResponse; this.Status = authenticationResponse.AuthenticationStatus; this.SessionToken = authenticationResponse.SessionToken; this.StateToken = authenticationResponse.StateToken; this.SaveAuthenticationStatus(this.Status); if (this.Status == "MFA_REQUIRED") { List <IVerifyFactor> verifyFactorsList = this.PrepareVerifyFactors(authenticationResponse); this.AssignVerifyFactors(verifyFactorsList); PolicyInfo policyInfo = this.PreparePolicyInfo(authenticationResponse); this.AssignPolicyInfo(policyInfo); } else if (this.Status == "MFA_CHALLENGE") { var factorResponse = JsonConvert.SerializeObject(authenticationResponse.Embedded["factor"]); FactorInfo factorObj = JsonConvert.DeserializeObject <FactorInfo>(factorResponse); string factorKey = GetFactorKey(factorObj); } else if (this.Status == "MFA_ENROLL") { List <IEnrollFactor> enrollFactorsList = this.PrepareEnrollFactors(authenticationResponse); this.AssignEnrollFactors(enrollFactorsList); } else if (this.Status == "PASSWORD_WARN") { if (!this.DonotChallengeCheckBoxState) { this.signOnPolicyRegistryHelper.AssignDeviceToken(this.username); } PolicyExpiration policyExpiration = this.PreparePolicyExpirationObject(authenticationResponse); this.AssignPolicyExpirationObj(policyExpiration); PolicyComplexity policyComplexity = this.PreparePolicyComplexityObject(authenticationResponse); this.AssignPolicyComplexityObj(policyComplexity); PolicyAge policyAge = this.PreparePolicyAgeObject(authenticationResponse); this.AssignPolicyAgeObj(policyAge); } else if (this.Status == "PASSWORD_EXPIRED") { if (!this.DonotChallengeCheckBoxState) { this.signOnPolicyRegistryHelper.AssignDeviceToken(this.username); } PolicyComplexity policyComplexity = this.PreparePolicyComplexityObject(authenticationResponse); this.AssignPolicyComplexityObj(policyComplexity); PolicyAge policyAge = this.PreparePolicyAgeObject(authenticationResponse); this.AssignPolicyAgeObj(policyAge); } else if (this.Status == "SUCCESS") { // } // State changed this.OnStateChange(this.Status); }