private TokenSecurityHeader GetAuthToken()
        {
            var defaultSize = 67108864;
            var defaultTime = new TimeSpan(0, 10, 0);

            var httpBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly)
            {
                Name = "FLWebBinding",
                MaxReceivedMessageSize = defaultSize,
                CloseTimeout           = defaultTime,
                OpenTimeout            = defaultTime,
                SendTimeout            = defaultTime,
                MaxBufferPoolSize      = defaultSize,
                MaxBufferSize          = defaultSize,
                TextEncoding           = Encoding.UTF8,
                TransferMode           = TransferMode.Buffered,
            };

            httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            httpBinding.Security.Mode = BasicHttpSecurityMode.None;

            var authEndpointAddress = new EndpointAddress(_verintConfiguration.AuthConnectionString);
            var auth = new FLAuthWebInterfaceClient(httpBinding, authEndpointAddress);

            using (new OperationContextScope(auth.InnerChannel))
            {
                var currentContext = OperationContext.Current;
                currentContext.OutgoingMessageHeaders.Add(new SecurityHeader(_verintConfiguration.Username, _verintConfiguration.Password));

                auth.verifyAsync().Wait();


                var data = currentContext.IncomingMessageHeaders.GetReaderAtHeader(0);
                data.ReadToFollowing("wsse:BinarySecurityToken");

                return(new TokenSecurityHeader(data.ReadElementContentAsString()));
            }
        }
Example #2
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(FLAuthWebInterfaceClient.GetEndpointAddress(EndpointConfiguration.FLAuth));
 }
Example #3
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(FLAuthWebInterfaceClient.GetBindingForEndpoint(EndpointConfiguration.FLAuth));
 }
Example #4
0
 public FLAuthWebInterfaceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(FLAuthWebInterfaceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Example #5
0
 public FLAuthWebInterfaceClient(EndpointConfiguration endpointConfiguration) :
     base(FLAuthWebInterfaceClient.GetBindingForEndpoint(endpointConfiguration), FLAuthWebInterfaceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Example #6
0
 public FLAuthWebInterfaceClient() :
     base(FLAuthWebInterfaceClient.GetDefaultBinding(), FLAuthWebInterfaceClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.FLAuth.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }