Ejemplo n.º 1
0
        protected static string IdentityClaimConverter(FilterBase filter, string suggestedAdProperty)
        {
            IdentityClaim ic = (IdentityClaim)filter.Value;

            if (ic.UrnScheme == null)
            {
                throw new ArgumentException(SR.StoreCtxIdentityClaimMustHaveScheme);
            }

            string urnValue = ic.UrnValue ?? "";

            string filterString = null;

            IdentityClaimToFilter(urnValue, ic.UrnScheme, ref filterString, true);

            return(filterString);
        }
Ejemplo n.º 2
0
        protected bool BuildLdapFilterFromIdentityClaim(string urnValue, string urnScheme, ref string filter, bool useSidHistory, bool throwOnFail)
        {
            // To build the filter, we'll use the same IdentityClaimConverter routine as the QBE mechanism.
            // This routine takes an IdentityClaimFilter as input, which in turn wraps an IdentityClaim.
            // So we'll build an IdentityClaim from the user's parameters.

            IdentityClaim ic = new IdentityClaim();
            ic.UrnValue = urnValue;
            ic.UrnScheme = urnScheme;

            IdentityClaimFilter icFilterBase = new IdentityClaimFilter();
            icFilterBase.Value = ic;

            if (useSidHistory)
            {
                // Special handling if we want to include the SID History in the search
                Debug.Assert(urnScheme == UrnScheme.SidScheme);
                StringBuilder sb = new StringBuilder();
                if (false == SecurityIdentityClaimConverterHelper(urnValue, useSidHistory, sb, throwOnFail))
                {
                    return false;
                }
                filter = sb.ToString();
            }
            else
            {
                if (false == IdentityClaimToFilter(urnValue, urnScheme, ref filter, throwOnFail))
                {
                    return false;
                }
            }

            return true;
        }