You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.142
Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
parent
e52655b4dc
commit
0abdbe5a7d
@ -290,87 +290,6 @@ namespace MonoTests.System.ServiceModel.Security
|
||||
Assert.IsNotNull (p, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void CreateProviderAnonSslError ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
new RecipientServiceModelSecurityTokenRequirement ();
|
||||
r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego;
|
||||
r.ListenUri = new Uri ("http://localhost:8080");
|
||||
r.SecurityBindingElement = new SymmetricSecurityBindingElement ();
|
||||
r.Properties [ReqType.IssuerBindingContextProperty] =
|
||||
new BindingContext (new CustomBinding (), new BindingParameterCollection ());
|
||||
r.MessageSecurityVersion =
|
||||
MessageSecurityVersion.Default.SecurityTokenVersion;
|
||||
SecurityTokenProvider p =
|
||||
def_c.CreateSecurityTokenProvider (r);
|
||||
Assert.IsNotNull (p, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("incomplete")]
|
||||
[Category ("NotWorking")]
|
||||
public void CreateProviderAnonSsl ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
new RecipientServiceModelSecurityTokenRequirement ();
|
||||
new MySslSecurityTokenParameters ().InitRequirement (r);
|
||||
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.ChannelParametersCollectionProperty), "#1");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.EndpointFilterTableProperty), "#2");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.HttpAuthenticationSchemeProperty), "#3");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.IsOutOfBandTokenProperty), "#4");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.IssuerAddressProperty), "#5");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.MessageDirectionProperty), "#6");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.MessageSecurityVersionProperty), "#7");
|
||||
//Assert.IsTrue (r.Properties.ContainsKey (SecurityTokenRequirement.PeerAuthenticationMode), "#8");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.SecurityAlgorithmSuiteProperty), "#9");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.SecurityBindingElementProperty), "#10");
|
||||
Assert.IsFalse (r.Properties.ContainsKey (ReqType.SupportingTokenAttachmentModeProperty), "#11");
|
||||
Assert.AreEqual (null, r.TransportScheme, "#12");
|
||||
|
||||
r.TokenType = ServiceModelSecurityTokenTypes.AnonymousSslnego;
|
||||
r.ListenUri = new Uri ("http://localhost:8080");
|
||||
r.SecurityBindingElement = new SymmetricSecurityBindingElement ();
|
||||
r.Properties [ReqType.IssuerBindingContextProperty] =
|
||||
new BindingContext (new CustomBinding (), new BindingParameterCollection ());
|
||||
r.MessageSecurityVersion =
|
||||
MessageSecurityVersion.Default.SecurityTokenVersion;
|
||||
|
||||
r.Properties [ReqType.SecurityAlgorithmSuiteProperty] =
|
||||
SecurityAlgorithmSuite.Default;
|
||||
r.TransportScheme = "https";
|
||||
|
||||
r.Properties [ReqType.ChannelParametersCollectionProperty] = new ChannelParameterCollection ();
|
||||
r.Properties [ReqType.EndpointFilterTableProperty] = null;
|
||||
r.Properties [ReqType.HttpAuthenticationSchemeProperty] = AuthenticationSchemes.Anonymous;
|
||||
r.Properties [ReqType.IsOutOfBandTokenProperty] = true;
|
||||
r.Properties [ReqType.IssuerAddressProperty] = new EndpointAddress ("http://localhost:9090");
|
||||
// r.Properties [ReqType.MessageDirectionProperty] = MessageDirection.Input;
|
||||
r.Properties [ReqType.SecurityBindingElementProperty] = new SymmetricSecurityBindingElement ();
|
||||
r.Properties [ReqType.SupportingTokenAttachmentModeProperty] = SecurityTokenAttachmentMode.Signed;
|
||||
|
||||
SecurityTokenProvider p =
|
||||
def_c.CreateSecurityTokenProvider (r);
|
||||
Assert.IsNotNull (p, "#1");
|
||||
}
|
||||
|
||||
RecipientServiceModelSecurityTokenRequirement CreateAnonSslRequirement ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
new RecipientServiceModelSecurityTokenRequirement ();
|
||||
MySslSecurityTokenParameters p = new MySslSecurityTokenParameters ();
|
||||
p.InitRequirement (r);
|
||||
r.SecurityBindingElement = new SymmetricSecurityBindingElement (new X509SecurityTokenParameters ());
|
||||
r.Properties [ReqType.IssuedSecurityTokenParametersProperty] = p.Clone ();
|
||||
r.Properties [ReqType.IssuerBindingContextProperty] =
|
||||
new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), new BindingParameterCollection ());
|
||||
r.Properties [ReqType.MessageSecurityVersionProperty] =
|
||||
MessageSecurityVersion.Default.SecurityTokenVersion;
|
||||
return r;
|
||||
}
|
||||
|
||||
RecipientServiceModelSecurityTokenRequirement CreateSecureConvRequirement ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
@ -396,107 +315,6 @@ namespace MonoTests.System.ServiceModel.Security
|
||||
return r;
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void CreateAuthenticatorAnonSslNoSecurityBindingElement ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
r.SecurityBindingElement = null;
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void CreateAuthenticatorAnonSslNoIssuedSecurityTokenParameters ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
r.Properties.Remove (ReqType.IssuedSecurityTokenParametersProperty);
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void CreateAuthenticatorAnonSslNoIssuerBindingContext ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
r.Properties.Remove (ReqType.IssuerBindingContextProperty);
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
// The type of exception should not matter though.
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
[Category ("NotWorking")]
|
||||
public void CreateAuthenticatorAnonSslNullMessageSecurityVersion ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
r.MessageSecurityVersion = null;
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void CreateAuthenticatorAnonSslNoMessageSecurityVersion ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
r.Properties.Remove (ReqType.MessageSecurityVersionProperty);
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (InvalidOperationException))]
|
||||
[Category ("NotWorking")]
|
||||
public void CreateAuthenticatorAnonSslNoServiceCertificate ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void CreateAuthenticatorAnonSslCertPublicOnly ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
SecurityTokenResolver resolver;
|
||||
def_c.ServiceCredentials.ServiceCertificate.Certificate =
|
||||
new X509Certificate2 ("Test/Resources/test.cer");
|
||||
def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
public void CreateAuthenticatorAnonSsl ()
|
||||
{
|
||||
RecipientServiceModelSecurityTokenRequirement r =
|
||||
CreateAnonSslRequirement ();
|
||||
SecurityTokenResolver resolver;
|
||||
X509Certificate2 cert = new X509Certificate2 ("Test/Resources/test.pfx", "mono");
|
||||
def_c.ServiceCredentials.ServiceCertificate.Certificate = cert;
|
||||
SecurityTokenAuthenticator a = def_c.CreateSecurityTokenAuthenticator (r, out resolver);
|
||||
// non-standard authenticator type.
|
||||
Assert.IsNotNull (resolver, "#1");
|
||||
Assert.IsTrue (a is IIssuanceSecurityTokenAuthenticator, "#2");
|
||||
|
||||
try {
|
||||
a.ValidateToken (new X509SecurityToken (cert));
|
||||
Assert.Fail ("It cannot validate raw X509SecurityToken");
|
||||
} catch (SecurityTokenValidationException) {
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void CreateProviderSecureConv ()
|
||||
|
Reference in New Issue
Block a user