public static bool IsInfocardRequired(Binding binding, ClientCredentials clientCreds, SecurityTokenManager clientCredentialsTokenManager, EndpointAddress target, out CardSpacePolicyElement[] infocardChain, out Uri relyingPartyIssuer)
        {
            infocardChain = null;
            bool flag = false;

            relyingPartyIssuer = null;
            if (!clientCreds.SupportInteractive || ((null != clientCreds.IssuedToken.LocalIssuerAddress) && (clientCreds.IssuedToken.LocalIssuerBinding != null)))
            {
                return(false);
            }
            IssuedSecurityTokenParameters parameters = TryGetNextStsIssuedTokenParameters(binding);

            if (parameters != null)
            {
                Uri uri;
                int num;
                GetPrivacyNoticeLinkFromIssuerBinding(binding, out uri, out num);
                PolicyElement[] chain = GetPolicyChain(target, binding, parameters, uri, num, clientCredentialsTokenManager);
                relyingPartyIssuer = null;
                if (chain != null)
                {
                    flag = RequiresInfoCard(chain, out relyingPartyIssuer);
                }
                if (!flag)
                {
                    return(flag);
                }
                infocardChain = new CardSpacePolicyElement[chain.Length];
                for (int i = 0; i < chain.Length; i++)
                {
                    infocardChain[i] = chain[i].ToCardSpacePolicyElement();
                }
            }
            return(flag);
        }
Esempio n. 2
0
        public static bool IsInfocardRequired(Binding binding, ClientCredentials clientCreds, SecurityTokenManager clientCredentialsTokenManager, EndpointAddress target, out CardSpacePolicyElement[] infocardChain, out Uri relyingPartyIssuer)
        {
            infocardChain = null;
            bool requiresInfoCard = false;

            relyingPartyIssuer = null;
            if (!clientCreds.SupportInteractive ||
                (null != clientCreds.IssuedToken.LocalIssuerAddress && null != clientCreds.IssuedToken.LocalIssuerBinding)
                )
            {
                return(false);
            }
            IssuedSecurityTokenParameters parameters = TryGetNextStsIssuedTokenParameters(binding);

            if (null != parameters)
            {
                Uri privacyNotice;
                int privacyVersion;
                GetPrivacyNoticeLinkFromIssuerBinding(binding, out privacyNotice, out privacyVersion);

                PolicyElement[] policyChain = GetPolicyChain(target, binding, parameters, privacyNotice, privacyVersion, clientCredentialsTokenManager);
                relyingPartyIssuer = null;
                if (null != policyChain)
                {
                    requiresInfoCard = RequiresInfoCard(policyChain, out relyingPartyIssuer);
                }
                if (requiresInfoCard)
                {
                    infocardChain = new CardSpacePolicyElement[policyChain.Length];
                    for (int i = 0; i < policyChain.Length; i++)
                    {
                        infocardChain[i] = policyChain[i].ToCardSpacePolicyElement();
                    }
                }
            }
            return(requiresInfoCard);
        }