public void IsIssuedSecurityTokenRequirement() { RecipientServiceModelSecurityTokenRequirement r; MyManager mgr = new MyManager(); r = new RecipientServiceModelSecurityTokenRequirement(); MySslSecurityTokenParameters ssl = new MySslSecurityTokenParameters(); ssl.InitRequirement(r); Assert.IsFalse(mgr.IsIssued(r), "ssl"); r = new RecipientServiceModelSecurityTokenRequirement(); MySspiSecurityTokenParameters sspi = new MySspiSecurityTokenParameters(); sspi.InitRequirement(r); Assert.IsFalse(mgr.IsIssued(r), "sspi"); r = new RecipientServiceModelSecurityTokenRequirement(); MyIssuedSecurityTokenParameters issued = new MyIssuedSecurityTokenParameters(); issued.InitRequirement(r); Assert.IsTrue(mgr.IsIssued(r), "issued"); /* * r = new RecipientServiceModelSecurityTokenRequirement (); * MySecureConversationSecurityTokenParameters sc = * new MySecureConversationSecurityTokenParameters ( * new SymmetricSecurityBindingElement (new X509SecurityTokenParameters ()), * false, * new ChannelProtectionRequirements ()); * r.Properties [ReqType.IssuerBindingContextProperty] = * new BindingContext (new CustomBinding (), new BindingParameterCollection ()); * r.Properties [ReqType.MessageSecurityVersionProperty] = * MessageSecurityVersion.Default; * r.Properties [ReqType.ChannelParametersCollectionProperty] = * new ChannelParameterCollection (); * r.Properties [ReqType.IssuedSecurityTokenParametersProperty] = sc.Clone (); * r.Properties [ReqType.IssuerBindingProperty] = * new CustomBinding (new HttpTransportBindingElement ()); * r.Properties [ReqType.MessageDirectionProperty] = * MessageDirection.Input; * r.SecureConversationSecurityBindingElement = * new SymmetricSecurityBindingElement ( * new X509SecurityTokenParameters ()); * r.SecurityAlgorithmSuite = SecurityAlgorithmSuite.Default; * r.Properties [ReqType.SupportSecurityContextCancellationProperty] = true; * r.ListenUri = new Uri ("http://localhost:8080"); * r.KeySize = 256; * sc.InitRequirement (r); * Assert.IsFalse (mgr.IsIssued (r), "sc"); */ }
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); }
public void IsIssuedSecurityTokenRequirement () { RecipientServiceModelSecurityTokenRequirement r; MyManager mgr = new MyManager (); r = new RecipientServiceModelSecurityTokenRequirement (); MySslSecurityTokenParameters ssl = new MySslSecurityTokenParameters (); ssl.InitRequirement (r); Assert.IsFalse (mgr.IsIssued (r), "ssl"); r = new RecipientServiceModelSecurityTokenRequirement (); MySspiSecurityTokenParameters sspi = new MySspiSecurityTokenParameters (); sspi.InitRequirement (r); Assert.IsFalse (mgr.IsIssued (r), "sspi"); r = new RecipientServiceModelSecurityTokenRequirement (); MyIssuedSecurityTokenParameters issued = new MyIssuedSecurityTokenParameters (); issued.InitRequirement (r); Assert.IsTrue (mgr.IsIssued (r), "issued"); /* r = new RecipientServiceModelSecurityTokenRequirement (); MySecureConversationSecurityTokenParameters sc = new MySecureConversationSecurityTokenParameters ( new SymmetricSecurityBindingElement (new X509SecurityTokenParameters ()), false, new ChannelProtectionRequirements ()); r.Properties [ReqType.IssuerBindingContextProperty] = new BindingContext (new CustomBinding (), new BindingParameterCollection ()); r.Properties [ReqType.MessageSecurityVersionProperty] = MessageSecurityVersion.Default; r.Properties [ReqType.ChannelParametersCollectionProperty] = new ChannelParameterCollection (); r.Properties [ReqType.IssuedSecurityTokenParametersProperty] = sc.Clone (); r.Properties [ReqType.IssuerBindingProperty] = new CustomBinding (new HttpTransportBindingElement ()); r.Properties [ReqType.MessageDirectionProperty] = MessageDirection.Input; r.SecureConversationSecurityBindingElement = new SymmetricSecurityBindingElement ( new X509SecurityTokenParameters ()); r.SecurityAlgorithmSuite = SecurityAlgorithmSuite.Default; r.Properties [ReqType.SupportSecurityContextCancellationProperty] = true; r.ListenUri = new Uri ("http://localhost:8080"); r.KeySize = 256; sc.InitRequirement (r); Assert.IsFalse (mgr.IsIssued (r), "sc"); */ }
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; }