예제 #1
0
        /// <summary>
        /// The PreparePolicyInfo
        /// </summary>
        /// <param name="authenticationResponse">The verifyFactorsList<see cref="IAuthenticationResponse"/></param>
        private PolicyInfo PreparePolicyInfo(IAuthenticationResponse authenticationResponse)
        {
            var        policyResponse = JsonConvert.SerializeObject(authenticationResponse.Embedded["policy"]);
            PolicyInfo policyObj      = JsonConvert.DeserializeObject <PolicyInfo>(policyResponse);

            return(policyObj);
        }
예제 #2
0
 /// <summary>
 /// The AssignPolicyInfo
 /// </summary>
 /// <param name="policyInfo">The verifyFactorsList<see cref="PolicyInfo"/></param>
 private void AssignPolicyInfo(PolicyInfo policyInfo)
 {
     this.policyInfo = policyInfo;
 }
예제 #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);
        }