Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,264 @@
2010-07-28 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs : another WS-SC test.
2010-07-28 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs :
enable some WS-SC tests.
2010-03-24 Atsushi Enomoto <atsushi@ximian.com>
* TransportSecurityBindingElementTest.cs : new test.
2009-12-14 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : disable non-working test that
needs several fixes or updates.
2008-02-28 Eyal Alaluf <eyala@mainsoft.com>
* WSSecurityTokenSerializerTest.cs: Fixed test run on Windows (failed also
on .Net).
2007-08-19 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs
ServiceCredentialsSecurityTokenManagerTest.cs
ScopedMessagePartSpecificationTest.cs : warning cleanup.
2007-04-02 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs : test that ssl
authenticator implements IIssuanceSecurityTokenAuthenticator.
2007-03-30 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : removed SCT reader test which
was DPAPI dependent, and added new DPAPI independent one.
2007-03-20 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : so, RequestedProofToken content
is unlikely readable here.
2007-03-13 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs : test DedaultValues().
* WSSecurityTokenSerializerTest.cs : added tests for SCT read/write.
2007-03-07 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs :
test for InitializeSecurityTokenRequirement() for several token
parameters (like existing tests in client credentials manager).
2007-03-01 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs : more tests for
AnonymousSslnego token authenticator.
2007-02-21 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : fixed DerivedKeyToken reader
tests, and added more.
2007-02-16 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : more WrappedKeySecurityToken.
2007-02-15 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added WrappedKeySecurityToken
reader test.
2007-02-06 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for reading
empty (invalid) UsernameToken.
2007-02-06 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for reading
EncryptedKeySHA1 embedded key.
2007-02-05 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added more tests for
EncryptedKey clause and BinarySecret clause writers.
2007-01-31 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added correct reader test for
SecurityTokenReference with KeyIdentifier. Existing test was broken.
2007-01-15 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs: some tests for writing derived-
key-involved key identifier clauses.
2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added some tests for
EmitBspRequiredAttributes.
2007-01-12 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added somewhat wrong test for
serialization for LocalIdKeyIdentifierClause with OwnerType.
2007-01-11 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : some tests for
SecurityContextSecurityToken.
* SecurityTokenSpeficicationTest.cs : new test.
2007-01-10 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added a few x509 tests for
SecurityVersion.WSSecurity10.
2006-12-09 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : finished incomplete
WriteWrappedKeySecurityToken() test.
2006-12-08 Atsushi Enomoto <atsushi@ximian.com>
* SecurityMessagePropertyTest.cs : test SenderIdPrefix as well.
* WSSecurityTokenSerializerTest.cs : added test for writing
LocalIdKeyIdentifierClause.
2006-12-08 Atsushi Enomoto <atsushi@ximian.com>
* ServiceSecurityContextTest.cs : new test.
* SecurityMessagePropertyTest.cs : after making several effort to
make GetOrCreateSecureMessage() pass (with new
InterceptorBindingElement), it turned out that GetOrCreate() does
not populate security information by itself...
2006-12-07 Atsushi Enomoto <atsushi@ximian.com>
* MessagePartSpecificationTest.cs : new test.
* ScopedMessagePartSpecificationTest.cs : added AddParts() tests.
2006-12-06 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for reading
EncryptedKeyIdentifierClause. Added test for writing
EncryptedKeyIdentifierClause which includes KeyIdentifier.
2006-12-06 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs :
enabled X509IssuerSerialKeyIdentifierClause writer test.
2006-12-05 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for
X509ThumbprintKeyIdentifierClause writer. Removed some NotWorking.
2006-10-12 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for writing
EncryptedKeyIdentifierClause. It is not the thing I needed for
non-included key serialization thus it's not implemented yet.
2006-10-06 Atsushi Enomoto <atsushi@ximian.com>
* SecurityMessagePropertyTest.cs : new file.
2006-09-27 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs :
a few more lines in Ssl create authenticator test.
2006-09-26 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs :
WriteToken() test for SecurityContextSecurityToken.
Incomplete/NotWorking ReadToken() test for DerivedKeyToken.
2006-09-22 Atsushi Enomoto <atsushi@ximian.com>
* SecurityAlgorithmSuiteTest.cs : fixed AsymmetricSignatureAlgorithm.
Use SecurityAlgorithms constants.
2006-09-21 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for LocalId
ReadKeyIdentifierClause().
2006-09-15 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs :
removed some NotWorking.
2006-09-15 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs :
some are notworking yet.
2006-09-12 Atsushi Enomoto <atsushi@ximian.com>
* ServiceCredentialsSecurityTokenManagerTest.cs : new test.
2006-09-12 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : test that RsaSecurityToken is
not supported.
2006-09-01 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : cleaning up NotWorking.
2006-08-29 Atsushi Enomoto <atsushi@ximian.com>
* ScopedMessagePartSpecificationTest.cs : new test.
2006-08-22 Atsushi Enomoto <atsushi@ximian.com>
* ChannelProtectionRequirementsTest.cs : new test.
2006-08-17 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added GetTokenTypeUri test.
2006-08-04 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs :
Added incomplete test for WriteWrappedKeySecurityToken(), but
I couldn't find any usable key identifier yet.
2006-08-04 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs :
Added test for GenericXmlSecurityToken serialization. Hmm, seems
like it is also useless for ws-trust.
2006-08-04 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs :
added test for WriteToken[Core] for BinarySecurityToken.
2006-08-01 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : added test for
WriteKeyIdentifierClause[Core] though not working.
2006-08-01 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : test some WriteToken[Core].
2006-07-31 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : test DefaultInstance as well.
2006-07-31 Atsushi Enomoto <atsushi@ximian.com>
* WSSecurityTokenSerializerTest.cs : new test.
2006-07-10 Atsushi Enomoto <atsushi@ximian.com>
* SecurityAlgorithmSuiteTest.cs,
SupportingTokenParametersTest.cs : new tests.

View File

@@ -0,0 +1,66 @@
//
// ChannelProtectionRequirementsTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Security
{
[TestFixture]
public class ChannelProtectionRequirementsTest
{
[Test]
public void DefaultValues ()
{
ChannelProtectionRequirements r =
new ChannelProtectionRequirements ();
Assert.AreEqual (false, r.IsReadOnly, "#1");
Assert.IsNotNull (r.IncomingSignatureParts, "#2");
Assert.IsNotNull (r.IncomingEncryptionParts, "#3");
Assert.IsNotNull (r.OutgoingSignatureParts, "#4");
Assert.IsNotNull (r.OutgoingEncryptionParts, "#5");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void AddToReadOnly ()
{
ChannelProtectionRequirements r =
new ChannelProtectionRequirements ();
r.MakeReadOnly ();
r.Add (new ChannelProtectionRequirements ());
}
}
}

View File

@@ -0,0 +1,88 @@
//
// MessagePartSpecificationTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
public class MessagePartSpecificationTest
{
[Test]
public void DefaultValues ()
{
MessagePartSpecification s =
new MessagePartSpecification ();
Assert.IsFalse (s.IsBodyIncluded, "#1");
Assert.AreEqual (0, s.HeaderTypes.Count, "#2");
s = new MessagePartSpecification (new XmlQualifiedName [] {new XmlQualifiedName ("foo", "urn:foo")});
Assert.IsFalse (s.IsBodyIncluded, "#3");
Assert.AreEqual (1, s.HeaderTypes.Count, "#4");
}
[Test]
public void Union ()
{
XmlQualifiedName q1, q2, q3;
q1 = new XmlQualifiedName ("foo");
q2 = new XmlQualifiedName ("bar");
q3 = new XmlQualifiedName ("baz");
MessagePartSpecification p1 =
new MessagePartSpecification (false, new XmlQualifiedName [] {q1, q2});
MessagePartSpecification p2 =
new MessagePartSpecification (true, new XmlQualifiedName [] {q3, q2});
p1.Union (p2);
Assert.IsTrue (p1.IsBodyIncluded, "#1");
// Sigh. It does not exclude duplicates.
Assert.AreEqual (4, p1.HeaderTypes.Count, "#1-2");
Assert.IsTrue (p1.HeaderTypes.Contains (q1), "#2");
Assert.IsTrue (p1.HeaderTypes.Contains (q2), "#3");
Assert.IsTrue (p1.HeaderTypes.Contains (q3), "#4");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void UnionReadOnlyPart ()
{
MessagePartSpecification s =
new MessagePartSpecification ();
s.MakeReadOnly ();
Assert.AreEqual (true, s.IsReadOnly, "#1");
s.Union (new MessagePartSpecification ());
}
}
}

View File

@@ -0,0 +1,134 @@
//
// ScopedMessagePartSpecificationTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
public class ScopedMessagePartSpecificationTest
{
[Test]
public void DefaultValues ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
Assert.IsNotNull (s.ChannelParts, "#1");
Assert.AreEqual (0, s.Actions.Count, "#2");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddPartsNull ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
s.AddParts (null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddPartsNull2 ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
s.AddParts (null, "urn:foo");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddPartsNull3 ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
s.AddParts (new MessagePartSpecification (), null);
}
[Test]
public void AddParts ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
Assert.IsFalse (s.ChannelParts.IsBodyIncluded, "#1");
s.AddParts (new MessagePartSpecification (true));
Assert.AreEqual (0, s.Actions.Count, "#2");
Assert.IsTrue (s.ChannelParts.IsBodyIncluded, "#3");
XmlQualifiedName foo = new XmlQualifiedName ("foo");
XmlQualifiedName bar = new XmlQualifiedName ("bar");
s.AddParts (new MessagePartSpecification (new XmlQualifiedName [] {foo}), "urn:foo");
Assert.AreEqual (1, s.Actions.Count, "#4");
MessagePartSpecification m;
s.TryGetParts ("urn:foo", out m);
Assert.IsNotNull (m, "#5");
Assert.AreEqual (1, m.HeaderTypes.Count, "#6");
s.AddParts (new MessagePartSpecification (true, new XmlQualifiedName [] {bar}), "urn:foo");
Assert.AreEqual (1, s.Actions.Count, "#7");
s.TryGetParts ("urn:foo", out m);
Assert.IsNotNull (m, "#8");
//List<XmlQualifiedName> l = new List<XmlQualifiedName> (m.HeaderTypes);
Assert.AreEqual (2, m.HeaderTypes.Count, "#9");
Assert.IsTrue (m.IsBodyIncluded, "#10");
}
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void AddToReadOnlyCollection ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
s.MakeReadOnly ();
Assert.AreEqual (true, s.IsReadOnly, "#1");
s.AddParts (new MessagePartSpecification (), "urn:myaction");
}
[Test]
public void TryGetParts ()
{
ScopedMessagePartSpecification s =
new ScopedMessagePartSpecification ();
MessagePartSpecification ret;
Assert.IsFalse (s.TryGetParts ("urn:myaction", out ret));
Assert.IsFalse (s.TryGetParts ("urn:myaction", true, out ret));
Assert.IsFalse (s.TryGetParts ("urn:myaction", false, out ret));
s.AddParts (new MessagePartSpecification (), "urn:myaction");
Assert.IsTrue (s.TryGetParts ("urn:myaction", out ret));
Assert.IsTrue (s.TryGetParts ("urn:myaction", true, out ret));
Assert.IsTrue (s.TryGetParts ("urn:myaction", false, out ret));
}
}
}

View File

@@ -0,0 +1,246 @@
//
// SecurityAlgorithmSuiteTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Tokens;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
public class SecurityAlgorithmSuiteTest
{
static void AssertSecurityAlgorithmSuite (
string defaultAsymmetricKeyWrapAlgorithm,
string defaultAsymmetricSignatureAlgorithm,
string defaultCanonicalizationAlgorithm,
string defaultDigestAlgorithm,
string defaultEncryptionAlgorithm,
int defaultEncryptionKeyDerivationLength,
int defaultSignatureKeyDerivationLength,
int defaultSymmetricKeyLength,
string defaultSymmetricKeyWrapAlgorithm,
string defaultSymmetricSignatureAlgorithm,
SecurityAlgorithmSuite target,
string label)
{
Assert.AreEqual (defaultAsymmetricKeyWrapAlgorithm,
target.DefaultAsymmetricKeyWrapAlgorithm,
label + ".DefaultAsymmetricKeyWrapAlgorithm");
Assert.AreEqual (defaultAsymmetricSignatureAlgorithm,
target.DefaultAsymmetricSignatureAlgorithm,
label + ".DefaultAsymmetricSignatureAlgorithm");
Assert.AreEqual (defaultCanonicalizationAlgorithm,
target.DefaultCanonicalizationAlgorithm,
label + ".DefaultCanonicalizationAlgorithm");
Assert.AreEqual (defaultDigestAlgorithm,
target.DefaultDigestAlgorithm,
label + ".DefaultDigestAlgorithm");
Assert.AreEqual (defaultEncryptionAlgorithm,
target.DefaultEncryptionAlgorithm,
label + ".DefaultEncryptionAlgorithm");
Assert.AreEqual (defaultEncryptionKeyDerivationLength,
target.DefaultEncryptionKeyDerivationLength,
label + ".DefaultEncryptionKeyDerivationLength");
Assert.AreEqual (defaultSignatureKeyDerivationLength,
target.DefaultSignatureKeyDerivationLength,
label + ".DefaultSignatureKeyDerivationLength");
Assert.AreEqual (defaultSymmetricKeyLength,
target.DefaultSymmetricKeyLength,
label + ".DefaultSymmetricKeyLength");
Assert.AreEqual (defaultSymmetricKeyWrapAlgorithm,
target.DefaultSymmetricKeyWrapAlgorithm,
label + ".DefaultSymmetricKeyWrapAlgorithm");
Assert.AreEqual (defaultSymmetricSignatureAlgorithm,
target.DefaultSymmetricSignatureAlgorithm,
label + ".DefaultSymmetricSignatureAlgorithm");
}
[Test]
public void DefaultAlgorithm ()
{
Assert.AreEqual (
SecurityAlgorithmSuite.Basic256,
SecurityAlgorithmSuite.Default, "#1");
}
[Test]
public void StaticPropertyValues ()
{
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSAOAEPUrl,
SignedXml.XmlDsigRSASHA1Url,
SignedXml.XmlDsigExcC14NTransformUrl,
SignedXml.XmlDsigSHA1Url,
EncryptedXml.XmlEncAES128Url,
// enc, sig, sym
128, 128, 128,
EncryptedXml.XmlEncAES128KeyWrapUrl,
SignedXml.XmlDsigHMACSHA1Url,
SecurityAlgorithmSuite.Basic128,
"Basic128");
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSA15Url,
SignedXml.XmlDsigRSASHA1Url,
SignedXml.XmlDsigExcC14NTransformUrl,
SignedXml.XmlDsigSHA1Url,
EncryptedXml.XmlEncAES128Url,
// enc, sig, sym
128, 128, 128,
EncryptedXml.XmlEncAES128KeyWrapUrl,
SignedXml.XmlDsigHMACSHA1Url,
SecurityAlgorithmSuite.Basic128Rsa15,
"Basic128Rsa15");
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSAOAEPUrl,
SecurityAlgorithms.RsaSha256Signature,
SignedXml.XmlDsigExcC14NTransformUrl,
EncryptedXml.XmlEncSHA256Url,
EncryptedXml.XmlEncAES128Url,
// enc, sig, sym
128, 128, 128,
EncryptedXml.XmlEncAES128KeyWrapUrl,
// Can't we get the same string from some const?
SecurityAlgorithms.HmacSha256Signature,
SecurityAlgorithmSuite.Basic128Sha256,
"Basic128Sha256");
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSA15Url,
SecurityAlgorithms.RsaSha256Signature,
SignedXml.XmlDsigExcC14NTransformUrl,
EncryptedXml.XmlEncSHA256Url,
EncryptedXml.XmlEncAES128Url,
// enc, sig, sym
128, 128, 128,
EncryptedXml.XmlEncAES128KeyWrapUrl,
// Can't we get the same string from some const?
SecurityAlgorithms.HmacSha256Signature,
SecurityAlgorithmSuite.Basic128Sha256Rsa15,
"Basic128Sha256Rsa15");
// ...192
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSA15Url,
SecurityAlgorithms.RsaSha256Signature,
SignedXml.XmlDsigExcC14NTransformUrl,
EncryptedXml.XmlEncSHA256Url,
EncryptedXml.XmlEncAES192Url,
// enc, sig, sym
192, 192, 192,
EncryptedXml.XmlEncAES192KeyWrapUrl,
// Can't we get the same string from some const?
SecurityAlgorithms.HmacSha256Signature,
SecurityAlgorithmSuite.Basic192Sha256Rsa15,
"Basic192Sha256Rsa15");
// ...256
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSAOAEPUrl,
SecurityAlgorithms.RsaSha256Signature,
SignedXml.XmlDsigExcC14NTransformUrl,
EncryptedXml.XmlEncSHA256Url,
EncryptedXml.XmlEncAES256Url,
// enc, sig, sym
256, 192, 256, // hmm, why 192 here?
EncryptedXml.XmlEncAES256KeyWrapUrl,
// Can't we get the same string from some const?
SecurityAlgorithms.HmacSha256Signature,
SecurityAlgorithmSuite.Basic256Sha256,
"Basic256Sha256");
// 3DES
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSAOAEPUrl,
SignedXml.XmlDsigRSASHA1Url,
SignedXml.XmlDsigExcC14NTransformUrl,
SignedXml.XmlDsigSHA1Url,
EncryptedXml.XmlEncTripleDESUrl,
// enc, sig, sym
192, 192, 192,
EncryptedXml.XmlEncTripleDESKeyWrapUrl,
SignedXml.XmlDsigHMACSHA1Url,
SecurityAlgorithmSuite.TripleDes,
"TripleDes");
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSA15Url,
SignedXml.XmlDsigRSASHA1Url,
SignedXml.XmlDsigExcC14NTransformUrl,
SignedXml.XmlDsigSHA1Url,
EncryptedXml.XmlEncTripleDESUrl,
// enc, sig, sym
192, 192, 192,
EncryptedXml.XmlEncTripleDESKeyWrapUrl,
SignedXml.XmlDsigHMACSHA1Url,
SecurityAlgorithmSuite.TripleDesRsa15,
"TripleDesRsa15");
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSAOAEPUrl,
SecurityAlgorithms.RsaSha256Signature,
SignedXml.XmlDsigExcC14NTransformUrl,
EncryptedXml.XmlEncSHA256Url,
EncryptedXml.XmlEncTripleDESUrl,
// enc, sig, sym
192, 192, 192,
EncryptedXml.XmlEncTripleDESKeyWrapUrl,
// Can't we get the same string from some const?
SecurityAlgorithms.HmacSha256Signature,
SecurityAlgorithmSuite.TripleDesSha256,
"TripleDesSha256");
AssertSecurityAlgorithmSuite (
EncryptedXml.XmlEncRSA15Url,
SecurityAlgorithms.RsaSha256Signature,
SignedXml.XmlDsigExcC14NTransformUrl,
EncryptedXml.XmlEncSHA256Url,
EncryptedXml.XmlEncTripleDESUrl,
// enc, sig, sym
192, 192, 192,
EncryptedXml.XmlEncTripleDESKeyWrapUrl,
// Can't we get the same string from some const?
SecurityAlgorithms.HmacSha256Signature,
SecurityAlgorithmSuite.TripleDesSha256Rsa15,
"TripleDesSha256Rsa15");
}
}
}

View File

@@ -0,0 +1,295 @@
//
// SecurityMessagePropertyTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Security;
using System.Security.Principal;
using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.Xml;
using System.Threading;
using NUnit.Framework;
using MonoTests.System.ServiceModel.Channels;
namespace MonoTests.System.ServiceModel.Security
{
[TestFixture]
public class SecurityMessagePropertyTest
{
static X509Certificate2 cert = new X509Certificate2 ("Test/Resources/test.pfx", "mono");
static X509Certificate2 cert2 = new X509Certificate2 ("Test/Resources/test2.pfx", "mono");
[ServiceContract]
public interface ICalc
{
[OperationContract]
int Sum (int a, int b);
[OperationContract (AsyncPattern = true)]
IAsyncResult BeginSum (int a, int b, AsyncCallback cb, object state);
int EndSum (IAsyncResult result);
}
public class CalcProxy : ClientBase<ICalc>, ICalc
{
public CalcProxy (Binding binding, EndpointAddress address)
: base (binding, address)
{
}
public int Sum (int a, int b)
{
return Channel.Sum (a, b);
}
public IAsyncResult BeginSum (int a, int b, AsyncCallback cb, object state)
{
return Channel.BeginSum (a, b, cb, state);
}
public int EndSum (IAsyncResult result)
{
return Channel.EndSum (result);
}
}
public class CalcService : ICalc
{
public int Sum (int a, int b)
{
return a + b;
}
public IAsyncResult BeginSum (int a, int b, AsyncCallback cb, object state)
{
return new CalcAsyncResult (a, b, cb, state);
}
public int EndSum (IAsyncResult result)
{
CalcAsyncResult c = (CalcAsyncResult) result;
return c.A + c.B;
}
}
class CalcAsyncResult : IAsyncResult
{
public int A, B;
AsyncCallback callback;
object state;
public CalcAsyncResult (int a, int b, AsyncCallback cb, object state)
{
A = a;
B = b;
callback = cb;
this.state = state;
}
public object AsyncState {
get { return state; }
}
public WaitHandle AsyncWaitHandle {
get { return null; }
}
public bool CompletedSynchronously {
get { return true; }
}
public bool IsCompleted {
get { return true; }
}
}
[Test]
public void GetOrCreateNonSecureMessage ()
{
Message m = Message.CreateMessage (MessageVersion.Default, "urn:myaction");
SecurityMessageProperty p =
SecurityMessageProperty.GetOrCreate (m);
Assert.IsNull (p.InitiatorToken, "#1");
Assert.IsNull (p.RecipientToken, "#2");
Assert.IsNull (p.ProtectionToken, "#3");
Assert.IsNull (p.TransportToken, "#4");
Assert.IsNull (p.ExternalAuthorizationPolicies, "#5");
// Assert.AreEqual (0, p.ExternalAuthorizationPolicies.Count, "#5");
Assert.IsFalse (p.HasIncomingSupportingTokens, "#6");
Assert.IsNotNull (p.IncomingSupportingTokens, "#6-2");
Assert.AreEqual ("_", p.SenderIdPrefix, "#6-3");
ServiceSecurityContext ssc = p.ServiceSecurityContext;
Assert.IsNotNull (ssc, "#7");
// not sure if it is worthy of testing though ...
GenericIdentity identity = ssc.PrimaryIdentity as GenericIdentity;
Assert.IsNotNull (identity, "#8-1");
Assert.AreEqual ("", identity.Name, "#8-2");
Assert.AreEqual ("", identity.AuthenticationType, "#8-3");
Assert.AreEqual (0, ssc.AuthorizationPolicies.Count, "#9");
Assert.IsTrue (ssc.IsAnonymous, "#10");
}
[Test]
[Ignore ("This hangs on .NET")]
// not sure how "good" this test is ... if it fails at
// service side, it just results in timeout error.
// The assertion makes sure that it passes all the tests, but
// in case it failed, there is almost no hint ...
public void GetOrCreateSecureMessage ()
{
bool passed = false;
ServiceHost host = new ServiceHost (typeof (CalcService));
InterceptorRequestContextHandler handler = delegate (MessageBuffer src) {
Message msg = src.CreateMessage ();
GetOrCreateSecureMessageAtService (msg);
passed = true;
};
try {
SymmetricSecurityBindingElement clisbe =
new SymmetricSecurityBindingElement ();
clisbe.ProtectionTokenParameters =
new X509SecurityTokenParameters (X509KeyIdentifierClauseType.Thumbprint, SecurityTokenInclusionMode.Never);
BindingElement transport = new HttpTransportBindingElement ();
BindingElement sintercept = new InterceptorBindingElement (handler);
CustomBinding b_res = new CustomBinding (clisbe,
sintercept,
transport);
b_res.ReceiveTimeout = b_res.SendTimeout = TimeSpan.FromSeconds (5);
host.AddServiceEndpoint (typeof (ICalc), b_res, "http://localhost:37564");
ServiceCredentials cred = new ServiceCredentials ();
cred.ServiceCertificate.Certificate = cert;
cred.ClientCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
host.Description.Behaviors.Add (cred);
host.Open ();
ProcessClient ();
} finally {
if (host.State == CommunicationState.Opened)
host.Close ();
}
if (!passed)
Assert.Fail ("Didn't pass the interceptor.");
}
void ProcessClient ()
{
SymmetricSecurityBindingElement svcsbe =
new SymmetricSecurityBindingElement ();
svcsbe.ProtectionTokenParameters =
new X509SecurityTokenParameters (X509KeyIdentifierClauseType.Thumbprint, SecurityTokenInclusionMode.Never);
BindingElement cintercept = new InterceptorBindingElement (null);
CustomBinding b_req = new CustomBinding (svcsbe,
cintercept,
new HttpTransportBindingElement ());
b_req.ReceiveTimeout = b_req.SendTimeout = TimeSpan.FromSeconds (5);
EndpointAddress remaddr = new EndpointAddress (
new Uri ("http://localhost:37564"),
new X509CertificateEndpointIdentity (cert));
CalcProxy proxy = new CalcProxy (b_req, remaddr);
proxy.ClientCredentials.ClientCertificate.Certificate = cert2;
proxy.Sum (1, 2);
proxy.Close ();
}
static void GetOrCreateSecureMessageAtClient (Message msg)
{
foreach (object o in msg.Properties)
if (o is SecurityMessageProperty)
Assert.Fail ("The input msg should not contain SecurityMessageProperty yet.");
SecurityMessageProperty p = SecurityMessageProperty.GetOrCreate (msg);
Assert.AreEqual (null, p.InitiatorToken, "#1");
Assert.AreEqual (null, p.RecipientToken, "#2");
Assert.IsNull (p.ProtectionToken, "#3");
Assert.IsNull (p.TransportToken, "#4");
Assert.IsNull (p.ExternalAuthorizationPolicies, "#5");
// Assert.AreEqual (0, p.ExternalAuthorizationPolicies.Count, "#5");
Assert.IsFalse (p.HasIncomingSupportingTokens, "#6");
Assert.IsNotNull (p.IncomingSupportingTokens, "#6-2");
Assert.AreEqual ("_", p.SenderIdPrefix, "#6-3");
ServiceSecurityContext ssc = p.ServiceSecurityContext;
Assert.IsNotNull (ssc, "#7");
// not sure if it is worthy of testing though ...
GenericIdentity identity = ssc.PrimaryIdentity as GenericIdentity;
Assert.IsNotNull (identity, "#8-1");
Assert.AreEqual ("", identity.Name, "#8-2");
Assert.AreEqual ("", identity.AuthenticationType, "#8-3");
Assert.AreEqual (0, ssc.AuthorizationPolicies.Count, "#9");
Assert.IsTrue (ssc.IsAnonymous, "#10");
}
static void GetOrCreateSecureMessageAtService (Message msg)
{
Assert.IsNull (msg.Properties.Security, "#0");
foreach (object o in msg.Properties)
if (o is SecurityMessageProperty)
Assert.Fail ("The input msg should not contain SecurityMessageProperty yet.");
SecurityMessageProperty p = SecurityMessageProperty.GetOrCreate (msg);
Assert.IsNotNull (msg.Properties.Security, "#0-2");
Assert.AreEqual (null, p.InitiatorToken, "#1");
Assert.AreEqual (null, p.RecipientToken, "#2");
Assert.IsNull (p.ProtectionToken, "#3");
Assert.IsNull (p.TransportToken, "#4");
Assert.IsNull (p.ExternalAuthorizationPolicies, "#5");
// Assert.AreEqual (0, p.ExternalAuthorizationPolicies.Count, "#5");
Assert.IsFalse (p.HasIncomingSupportingTokens, "#6");
Assert.IsNotNull (p.IncomingSupportingTokens, "#6-2");
Assert.AreEqual ("_", p.SenderIdPrefix, "#6-3");
ServiceSecurityContext ssc = p.ServiceSecurityContext;
Assert.IsNotNull (ssc, "#7");
// not sure if it is worthy of testing though ...
GenericIdentity identity = ssc.PrimaryIdentity as GenericIdentity;
Assert.IsNotNull (identity, "#8-1");
Assert.AreEqual ("", identity.Name, "#8-2");
Assert.AreEqual ("", identity.AuthenticationType, "#8-3");
Assert.AreEqual (0, ssc.AuthorizationPolicies.Count, "#9");
Assert.IsTrue (ssc.IsAnonymous, "#10");
}
}
}

View File

@@ -0,0 +1,52 @@
//
// SecurityTokenSpeficicationTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2007 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Policy;
using System.IdentityModel.Tokens;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
public class SecurityTokenSpeficicationTest
{
[Test]
public void ConstructorNullPolicies ()
{
new SecurityTokenSpecification (new UserNameSecurityToken ("mono", "monopass"), new ReadOnlyCollection<IAuthorizationPolicy> (new IAuthorizationPolicy [0]));
}
}
}

View File

@@ -0,0 +1,89 @@
//
// ServiceSecurityContextTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Security;
using System.IdentityModel.Policy;
using System.Security.Principal;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using NUnit.Framework;
using PolicyList = System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Policy.IAuthorizationPolicy>;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
public class ServiceSecurityContextTest
{
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ConstructorNullArgs1 ()
{
new ServiceSecurityContext (null, null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ConstructorNullArgs2 ()
{
new ServiceSecurityContext ((AuthorizationContext) null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void ConstructorNullArgs3 ()
{
new ServiceSecurityContext ((PolicyList) null);
}
[Test]
public void Constructor ()
{
ServiceSecurityContext c = new ServiceSecurityContext (new PolicyList (new IAuthorizationPolicy [0]));
Assert.IsNotNull (c.AuthorizationContext, "#1");
Assert.AreEqual (0, c.AuthorizationPolicies.Count, "#2");
// it is somehow treated as anonymous ...
Assert.IsTrue (c.IsAnonymous, "#3");
// FIXME: test PrimaryIdentity
}
[Test]
public void Anonymous ()
{
ServiceSecurityContext c = ServiceSecurityContext.Anonymous;
Assert.IsNotNull (c.AuthorizationContext, "#1");
Assert.AreEqual (0, c.AuthorizationPolicies.Count, "#2");
Assert.IsTrue (c.IsAnonymous, "#3");
// FIXME: test PrimaryIdentity
}
}
}

View File

@@ -0,0 +1,54 @@
//
// SupportingTokenParametersTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2006 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel
{
[TestFixture]
public class SupportingTokenParametersTest
{
[Test]
public void DefaultItems ()
{
SupportingTokenParameters p = new SupportingTokenParameters ();
Assert.AreEqual (0, p.Endorsing.Count, "#1");
Assert.AreEqual (0, p.Signed.Count, "#2");
Assert.AreEqual (0, p.SignedEncrypted.Count, "#3");
Assert.AreEqual (0, p.SignedEndorsing.Count, "#4");
}
}
}

View File

@@ -0,0 +1,51 @@
//
// TransportSecurityBindingElementTest.cs
//
// Author:
// Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) 2009 Novell, Inc. http://www.novell.com
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Net;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Security.Cryptography.Xml;
using NUnit.Framework;
namespace MonoTests.System.ServiceModel.Security
{
[TestFixture]
public class TransportSecurityBindingElementTest
{
[Test]
public void DefaultValues ()
{
var be = new TransportSecurityBindingElement ();
}
}
}