void CreateProviderOpenGetToken (bool getToken) { MyParameters tp = new MyParameters (); InitiatorServiceModelSecurityTokenRequirement r = new InitiatorServiceModelSecurityTokenRequirement (); tp.InitRequirement (r); r.TargetAddress = new EndpointAddress ("http://localhost:8080"); r.SecurityBindingElement = new SymmetricSecurityBindingElement (); r.Properties [ReqType.IssuerBindingContextProperty] = new BindingContext (new CustomBinding (new HttpTransportBindingElement ()), new BindingParameterCollection ()); r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; // This is required at GetToken(). r.SecurityAlgorithmSuite = SecurityAlgorithmSuite.Default; ClientCredentials cred = new ClientCredentials (); ClientCredentialsSecurityTokenManager manager = new ClientCredentialsSecurityTokenManager (cred); // TLS negotiation token provider is created. SecurityTokenProvider p = manager.CreateSecurityTokenProvider (r); ((ICommunicationObject) p).Open (); if (!getToken) return; p.GetToken (TimeSpan.FromSeconds (5)); }
public void CreateProvider () { MyParameters tp = new MyParameters (); InitiatorServiceModelSecurityTokenRequirement r = new InitiatorServiceModelSecurityTokenRequirement (); tp.InitRequirement (r); r.TargetAddress = new EndpointAddress ("http://localhost:8080"); r.SecurityBindingElement = new SymmetricSecurityBindingElement (); r.Properties [ReqType.IssuerBindingContextProperty] = new BindingContext (new CustomBinding (), new BindingParameterCollection ()); r.MessageSecurityVersion = MessageSecurityVersion.Default.SecurityTokenVersion; ClientCredentials cred = new ClientCredentials (); ClientCredentialsSecurityTokenManager manager = new ClientCredentialsSecurityTokenManager (cred); //SecurityTokenProvider p = manager.CreateSecurityTokenProvider (r); }
public void CreateProviderNoTargetAddress () { MyParameters tp = new MyParameters (); InitiatorServiceModelSecurityTokenRequirement r = new InitiatorServiceModelSecurityTokenRequirement (); tp.InitRequirement (r); ClientCredentials cred = new ClientCredentials (); ClientCredentialsSecurityTokenManager manager = new ClientCredentialsSecurityTokenManager (cred); manager.CreateSecurityTokenProvider (r); }
public void CreateProviderNoIssuerBindingContext () { MyParameters tp = new MyParameters (); InitiatorServiceModelSecurityTokenRequirement r = new InitiatorServiceModelSecurityTokenRequirement (); tp.InitRequirement (r); r.TargetAddress = new EndpointAddress ("http://localhost:8080"); r.SecurityBindingElement = new SymmetricSecurityBindingElement (); ClientCredentials cred = new ClientCredentials (); ClientCredentialsSecurityTokenManager manager = new ClientCredentialsSecurityTokenManager (cred); //SecurityTokenProvider p = manager.CreateSecurityTokenProvider (r); }
void CreateRecipientProviderCore (bool mutual) { MyParameters tp = new MyParameters (); tp.RequireClientCertificate = true; RecipientServiceModelSecurityTokenRequirement r = new RecipientServiceModelSecurityTokenRequirement (); tp.InitRequirement (r); 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; ClientCredentials cred = new ClientCredentials (); ClientCredentialsSecurityTokenManager manager = new ClientCredentialsSecurityTokenManager (cred); manager.CreateSecurityTokenProvider (r); }