Example #1
0
        public echoResponse Echo(echo echoRequest)
        {
            ValidateLibertyFrameworkHeader(echoRequest.Framework);

            Structure businessResponse = ProcessBusinessLogic(echoRequest.structureToEcho);

            echoResponse echoReply = BuildResponseMessage(businessResponse);

            InsertWsAddressingMessageIdOnResponse();

            return echoReply;
        }
        public void WebserviceproviderReceivesWrongAudience()
        {
            SecurityToken bootstrapSecurityToken = BootstrapSecurityTokenGenerator.MakeBootstrapSecurityToken();

            Uri audience = new Uri("http://NotValidEndPoint/Echo");//Failure

            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 = new LibertyFrameworkHeader();
            
            echoService.Echo(req);
        }
        public void CommunicationWithWebserviceProvider()
        {
            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)));
            ICommunicationObject channel = (ICommunicationObject)echoService;

            var req = new echo();
            req.structureToEcho = new Structure();
            req.Framework = new LibertyFrameworkHeader();
            var echoReply = echoService.Echo(req);

            channel.Close();

            Assert.IsNotNull(echoReply);
        }
        public void JAVAServiceNoSSLConversation()
        {
            SecurityToken bootstrapSecurityToken = BootstrapSecurityTokenGenerator.MakeBootstrapSecurityToken();

            Uri audience = new Uri("http://jre-mac.trifork.com:8880/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("http://jre-mac.trifork.com:8880/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 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);
        }