コード例 #1
0
        /// <summary>
        /// Get Claims for provided principal without encode
        /// </summary>
        /// <param name="principal">Distinguished Name of the principal</param>
        /// <param name="principalClass">class of principal, user or device</param>
        /// <param name="source">claim source type, AD or Certificate</param>
        /// <returns>a list of CLAIMS_ARRAY for the principal</returns>
        public List <CLAIMS_ARRAY> GetClaimsForPrincipalWithoutEncode(string principal, ClaimsPrincipalClass principalClass, ClaimsSource source)
        {
            List <CLAIMS_ARRAY> ret = new List <CLAIMS_ARRAY>();

            #region get principal object
            using (DirectoryEntry princ = new DirectoryEntry("LDAP://" + principal,
                                                             domainDNS + "\\" + UserName, Password, AuthenticationTypes.Secure))
            {
                #endregion
                #region AD source
                if (source.HasFlag(ClaimsSource.AD))
                {
                    CLAIMS_ARRAY ad = getADSoucredClaims(princ, principalClass);
                    ret.Add(ad);
                    //Constructed claims use the CLAIMS_SOURCE_TYPE_AD source type
                    ad = getConstructedClaims(princ, principalClass);
                    ret.Add(ad);
                }
                #endregion


                #region certificate source
                //not implemented
                #endregion

                return(ret);
            }
        }
コード例 #2
0
        /// <summary>
        /// Get Claims for provided principal without encode
        /// </summary>
        /// <param name="principal">Distinguished Name of the principal</param>
        /// <param name="principalClass">class of principal, user or device</param>
        /// <param name="source">claim source type, AD or Certificate</param>
        /// <returns>a list of CLAIMS_ARRAY for the principal</returns>
        public List<CLAIMS_ARRAY> GetClaimsForPrincipalWithoutEncode(string principal, ClaimsPrincipalClass principalClass, ClaimsSource source)
        {
            List<CLAIMS_ARRAY> ret = new List<CLAIMS_ARRAY>();

            #region get principal object
            using (DirectoryEntry princ = new DirectoryEntry("LDAP://" + principal,
                domainDNS + "\\" + UserName, Password, AuthenticationTypes.Secure))
            {

            #endregion
                #region AD source
                if (source.HasFlag(ClaimsSource.AD))
                {
                    CLAIMS_ARRAY ad = getADSoucredClaims(princ, principalClass);
                    ret.Add(ad);
                    //Constructed claims use the CLAIMS_SOURCE_TYPE_AD source type
                    ad = getConstructedClaims(princ, principalClass);
                    ret.Add(ad);
                }
                #endregion

                #region certificate source
                //not implemented
                #endregion

                return ret;
            }
        }