public void JAVAServiceSSLConversation()
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            SecurityToken bootstrapSecurityToken = BootstrapSecurityTokenGenerator.MakeBootstrapSecurityToken();

            Uri audience = new Uri("https://oiosaml.trifork.com:8082/poc-provider/GenevaProviderService");

            RequestSecurityToken rst = WSTrustClientFactory.MakeOnBehalfOfSTSRequestSecurityToken(bootstrapSecurityToken, clientCertifikat, audience, requestClaims);

            var token = STSConnection.GetIssuedToken(rst);

            IEchoService echoService = WebserviceproviderChannelFactory.CreateChannelWithIssuedToken <IEchoService>(token, clientCertifikat, serviceCertifikat, new EndpointAddress(new Uri("https://oiosaml.trifork.com:8082/poc-provider/GenevaProviderService")));

            var req = new echo();

            req.structureToEcho       = new Structure();
            req.structureToEcho.value = "kvlsjvsldk";
            req.Framework             = new LibertyFrameworkHeader();

            var reply = echoService.Echo(req);

            Assert.IsNotNull(reply.Framework);
            Assert.IsNotNull(reply.structureToEcho.value);
        }
        public GenericXmlSecurityToken GetIssuedToken(RequestSecurityToken rst)
        {
            EndpointAddress endpointAddress = new EndpointAddress(STSAddress, EndpointIdentity.CreateDnsIdentity(DnsIdentityForServiceCertificates));
            WSTrustClient   trustClient     = WSTrustClientFactory.GetWSTrustClient(clientCertifikat, serviceCertifikat, endpointAddress);

            GenericXmlSecurityToken token = (GenericXmlSecurityToken)trustClient.Issue(rst);

            trustClient.Close();
            return(token);
        }
        public void GetSaml2SecurityTokenFromJavaSTS()
        {
            SecurityToken bootstrapSecurityToken = BootstrapSecurityTokenGenerator.MakeBootstrapSecurityToken();

            RequestSecurityToken rst = WSTrustClientFactory.MakeOnBehalfOfSTSRequestSecurityToken(bootstrapSecurityToken, clientCertifikat, new Uri("http://localhost/Echo/service.svc/Echo"), requestClaims);

            GenericXmlSecurityToken token = GetIssuedToken(rst);

            Assert.IsTrue(token.InternalTokenReference.ToString().Contains("Saml2"));
        }
        public void MissingLibertyHeader()
        {
            SecurityToken bootstrapSecurityToken = BootstrapSecurityTokenGenerator.MakeBootstrapSecurityToken();

            Uri audience = new Uri("http://localhost/Echo/service.svc/Echo");

            RequestSecurityToken rst = WSTrustClientFactory.MakeOnBehalfOfSTSRequestSecurityToken(bootstrapSecurityToken, clientCertifikat, audience, requestClaims);

            var token = STSConnection.GetIssuedToken(rst);

            IEchoService echoService = WebserviceproviderChannelFactory.CreateChannelWithIssuedToken <IEchoService>(token, clientCertifikat, serviceCertifikat, new EndpointAddress(new Uri("http://lh-z3jyrnwtj9d7/EchoWebserviceProvider/service.svc/Echo"), new DnsEndpointIdentity(DnsIdentityForServiceCertificates)));

            var req = new echo();

            req.structureToEcho = new Structure();
            req.Framework       = null; //Failure

            echoService.Echo(req);
        }
        public void DotNetServiceSSLConversation()
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            SecurityToken bootstrapSecurityToken = BootstrapSecurityTokenGenerator.MakeBootstrapSecurityToken();

            Uri audience = new Uri("http://localhost/Echo/service.svc/Echo");

            RequestSecurityToken rst = WSTrustClientFactory.MakeOnBehalfOfSTSRequestSecurityToken(bootstrapSecurityToken, clientCertifikat, audience, requestClaims);

            var token = STSConnection.GetIssuedToken(rst);

            IEchoService echoService = WebserviceproviderChannelFactory.CreateChannelWithIssuedToken <IEchoService>(token, clientCertifikat, serviceCertifikat, new EndpointAddress(new Uri("https://lh-z3jyrnwtj9d7/EchoWebserviceProvider/service.svc/Echo")));

            var req = new echo();

            req.structureToEcho = new Structure();
            req.Framework       = new LibertyFrameworkHeader();

            var reply = echoService.Echo(req);

            Assert.IsNotNull(reply.Framework);
        }