Exemplo n.º 1
0
        private PolicyAge PreparePolicyAgeObject(IAuthenticationResponse authenticationResponse)
        {
            var       policyResponseObject = JsonConvert.SerializeObject(authenticationResponse.Embedded["policy"]);
            dynamic   policyAgeObj         = JsonConvert.DeserializeObject <dynamic>(policyResponseObject).age;
            string    policyAgeString      = JsonConvert.SerializeObject(policyAgeObj);
            PolicyAge policyAge            = JsonConvert.DeserializeObject <PolicyAge>(policyAgeString);

            return(policyAge);
        }
Exemplo n.º 2
0
 private void AssignPolicyAgeObj(PolicyAge policyAge)
 {
     this.policyAge = policyAge;
 }
Exemplo n.º 3
0
        /// <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);
        }