コード例 #1
0
        public void IndexDoc_Security_CannotAddPasswordHash()
        {
            var passwordHashFieldName = "PasswordHash";
            var passwordHashField     = new IndexField(passwordHashFieldName, "31275491872354956198543",
                                                       IndexingMode.NotAnalyzed, IndexStoringMode.No, IndexTermVector.No);
            var indexDoc = new IndexDocument {
                passwordHashField
            };

            Assert.IsFalse(indexDoc.Any(f => f.Name == passwordHashFieldName));
            Assert.IsNull(indexDoc.GetStringValue(passwordHashFieldName));

            Assert.IsFalse(indexDoc.Fields.ContainsKey(passwordHashFieldName));
        }
コード例 #2
0
ファイル: IndexDocumentTests.cs プロジェクト: y1027/sensenet
        public void IndexDoc_Security_CannotAddPasswordHash()
        {
            var passwordHashFieldName = "PasswordHash";
            var passwordHashField     = new IndexField(passwordHashFieldName, "31275491872354956198543",
                                                       IndexingMode.NotAnalyzed, IndexStoringMode.No, IndexTermVector.No);
            var indexDoc = new IndexDocument {
                passwordHashField
            };

            Assert.IsFalse(indexDoc.Any(f => f.Name == passwordHashFieldName));
            Assert.IsNull(indexDoc.GetStringValue(passwordHashFieldName));

            var indexDocAcc = new PrivateObject(indexDoc);
            var fields      = (Dictionary <string, IndexField>)indexDocAcc.GetFieldOrProperty("_fields");

            Assert.IsFalse(fields.ContainsKey(passwordHashFieldName));
        }
コード例 #3
0
        public void IndexDoc_Security_CannotAddPassword()
        {
            var passwordFieldName = "Password";
            var passwordField     = new IndexField(passwordFieldName, "password123",
                                                   IndexingMode.NotAnalyzed, IndexStoringMode.No, IndexTermVector.No);
            var indexDoc = new IndexDocument {
                passwordField
            };

            Assert.IsFalse(indexDoc.Any(f => f.Name == passwordFieldName));
            Assert.IsNull(indexDoc.GetStringValue(passwordFieldName));

            var indexDocAcc = new ObjectAccessor(indexDoc);
            var fields      = (Dictionary <string, IndexField>)indexDocAcc.GetFieldOrProperty("_fields");

            Assert.IsFalse(fields.ContainsKey(passwordFieldName));
        }