Пример #1
0
        public CommonPostMaster(SecurityInfo self, PostMaster innerPostMaster, EtkDepotPortTypeClient etkDepot, KgssPortTypeClient kgss)
            : base(self, etkDepot, kgss)
        {
            if (self == null)
            {
                throw new ArgumentNullException("self");
            }
            if (self.IsSendOnly)
            {
                throw new ArgumentException("The self argument must be able to receive", "self");
            }
            if (self.Token == null)
            {
                throw new ArgumentException("The self argument must have a ETK", "self");
            }
            if (etkDepot == null)
            {
                throw new ArgumentNullException("etkDepot");
            }
            if (kgss == null)
            {
                throw new ArgumentNullException("kgss");
            }

            this.innerPostMaster = innerPostMaster;

            mcnList = new Collection <KnownRecipient>();
            mcnList.Add(new KnownRecipient("CBE", "0820563481", "MYCARENET"));

            ioList = new Collection <UnknownRecipient>();
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411702543")); //100
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411709768")); //200
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411724220")); //300
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411729366")); //400
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411766483")); //500
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0206732437")); //600
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0250871001")); //900
        }
Пример #2
0
        public CommonPostMaster(SecurityInfo self, PostMaster innerPostMaster, EtkDepotPortTypeClient etkDepot, KgssPortTypeClient kgss)
            : base(self, etkDepot, kgss)
        {
            if (self == null) throw new ArgumentNullException("self");
            if (self.IsSendOnly) throw new ArgumentException("The self argument must be able to receive", "self");
            if (self.Token == null) throw new ArgumentException("The self argument must have a ETK", "self");
            if (etkDepot == null) throw new ArgumentNullException("etkDepot");
            if (kgss == null) throw new ArgumentNullException("kgss");

            this.innerPostMaster = innerPostMaster;

            mcnList = new Collection<KnownRecipient>();
            mcnList.Add(new KnownRecipient("CBE", "0820563481", "MYCARENET"));

            ioList = new Collection<UnknownRecipient>();
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411702543")); //100
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411709768")); //200
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411724220")); //300
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411729366")); //400
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0411766483")); //500
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0206732437")); //600
            ioList.Add(new UnknownRecipient("urn:be:fgov:identification-namespace", "urn:be:fgov:ehealth:1.0:certificateholder:enterprise:cbe-number", "0250871001")); //900
        }
Пример #3
0
 public SecondPassAskPostMaster(SecurityInfo self, Chap4AgreementAdmissionPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Пример #4
0
        public void ConfigDoctorViaCode()
        {
            //Create SSOBinding
            var ssoBinding = new SsoBinding();

            ssoBinding.Security.Mode = WSFederationHttpSecurityMode.Message;
            ssoBinding.Security.Message.IssuedKeyType = SecurityKeyType.AsymmetricKey;
            ssoBinding.Security.Message.NegotiateServiceCredential = false;
            ssoBinding.Security.Message.EstablishSecurityContext   = false;

            ssoBinding.Security.Message.IssuerAddress = new EndpointAddress("https://wwwacc.ehealth.fgov.be/sts_1_1/SecureTokenService");
            ssoBinding.Security.Message.IssuerBinding = new StsBinding();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<saml:Attribute xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" AttributeNamespace=\"urn:be:fgov:identification-namespace\" AttributeName=\"urn:be:fgov:person:ssin\">" +
                        "<saml:AttributeValue xsi:type=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">79021802145</saml:AttributeValue>" +
                        "</saml:Attribute>");
            ssoBinding.Security.Message.TokenRequestParameters.Add(doc.DocumentElement);
            doc = new XmlDocument();
            doc.LoadXml("<saml:Attribute xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" AttributeNamespace=\"urn:be:fgov:identification-namespace\" AttributeName=\"urn:be:fgov:ehealth:1.0:certificateholder:person:ssin\">" +
                        "<saml:AttributeValue xsi:type=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">79021802145</saml:AttributeValue>" +
                        "</saml:Attribute>");
            ssoBinding.Security.Message.TokenRequestParameters.Add(doc.DocumentElement);

            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:identification-namespace}urn:be:fgov:person:ssin"));
            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:identification-namespace}urn:be:fgov:ehealth:1.0:certificateholder:person:ssin"));
            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:certified-namespace:ehealth}urn:be:fgov:person:ssin:doctor:boolean"));
            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:certified-namespace:ehealth}urn:be:fgov:person:ssin:ehealth:1.0:doctor:nihii11"));

            //Creating basic https binding
            BasicHttpBinding httpsBinding = new BasicHttpBinding();

            httpsBinding.Security.Mode = BasicHttpSecurityMode.Transport;

            //Create the Consult proxy
            Chap4AgreementConsultationPortTypeClient consult = new Chap4AgreementConsultationPortTypeClient(ssoBinding, new EndpointAddress("https://services-acpt.ehealth.fgov.be/ChapterIV/ChapterIVAgreementConsultation/v1"));

            consult.Endpoint.Behaviors.Remove <ClientCredentials>();
            consult.Endpoint.Behaviors.Add(new SsoClientCredentials());
            consult.Endpoint.Behaviors.Add(new SessionBehavior(session, TimeSpan.FromHours(1), typeof(MemorySessionCache), null));
            consult.ClientCredentials.ClientCertificate.Certificate = auth; //must be put after the behavior

            //Create KGSS proxy
            KgssPortTypeClient kgss = new KgssPortTypeClient(httpsBinding, new EndpointAddress("https://services-acpt.ehealth.fgov.be/Kgss/v1"));

            //Create ETK Depot proxy
            EtkDepotPortTypeClient etkDepot = new EtkDepotPortTypeClient(httpsBinding, new EndpointAddress("https://services-acpt.ehealth.fgov.be/EtkDepot/v1"));

            //Create self
            SecurityInfo self = SecurityInfo.Create(sign, StoreLocation.CurrentUser, etkDepot);

            //Create Consult postmaster
            ConsultPostMaster postmaster = new ConsultPostMaster(self, consult, etkDepot, kgss);

            postmaster.VerifyEtk = false;

            //prepare the input
            InputParameterData parameters = new InputParameterData();

            parameters.CommonInput                        = new CommonInputType();
            parameters.CommonInput.Request                = new RequestType1();
            parameters.CommonInput.Request.IsTest         = true;
            parameters.CommonInput.Origin                 = new OriginType();
            parameters.CommonInput.Origin.Package         = new PackageType();
            parameters.CommonInput.Origin.Package.License = new LicenseType();
            //parameters.CommonInput.Origin.Package.License.Username = "******"; //provide you own license
            //parameters.CommonInput.Origin.Package.License.Password = "******"; //provide your own password
            parameters.CommonInput.Origin.Package.License.Username = "******";    //provide you own license
            parameters.CommonInput.Origin.Package.License.Password = "******"; //provide your own password

            parameters.CommonInput.Origin.CareProvider                           = new CareProviderType();
            parameters.CommonInput.Origin.CareProvider.Nihii                     = new NihiiType();
            parameters.CommonInput.Origin.CareProvider.Nihii.Quality             = "doctor";
            parameters.CommonInput.Origin.CareProvider.Nihii.Value               = new ValueRefString();
            parameters.CommonInput.Origin.CareProvider.Nihii.Value.Value         = "19997341001";
            parameters.CommonInput.Origin.CareProvider.PhysicalPerson            = new IdType();
            parameters.CommonInput.Origin.CareProvider.PhysicalPerson.Ssin       = new ValueRefString();
            parameters.CommonInput.Origin.CareProvider.PhysicalPerson.Ssin.Value = "79021802145";
            parameters.RecordCommonInput = new RecordCommonInputType();
            parameters.RecordCommonInput.InputReferenceSpecified = true;
            parameters.RecordCommonInput.InputReference          = 20101112100503;
            parameters.AgreementStartDate  = new DateTime(2013, 04, 01, 0, 0, 0, DateTimeKind.Utc);
            parameters.CareReceiverId      = new CareReceiverIdType();
            parameters.CareReceiverId.Ssin = "01093008501";

            //send the request
            X509Certificate2 sender;
            Tuple <Stream, OutputParameterData> response = postmaster.Transfer(new FileStream("request_consult_physician.xml", FileMode.Open), parameters, out sender);

            WriteFormattedXml(response.Item1);

            //Chech for business responses
            XmlDocument         responseDoc = new XmlDocument();
            XmlNamespaceManager nsmgr       = new XmlNamespaceManager(responseDoc.NameTable);

            nsmgr.AddNamespace("ns", "http://www.ehealth.fgov.be/medicalagreement/core/v1");
            nsmgr.AddNamespace("kmehr", "http://www.ehealth.fgov.be/standards/kmehr/schema/v1");
            responseDoc.Load(response.Item1);
            XmlNodeList errorList = responseDoc.SelectNodes("/ns:kmehrresponse/ns:acknowledge/ns:error", nsmgr);

            if (errorList.Count > 0)
            {
                StringBuilder errorMsg = new StringBuilder();
                foreach (XmlNode error in errorList)
                {
                    errorMsg.Append(error.SelectSingleNode("./kmehr:cd", nsmgr).InnerText)
                    .Append(": ")
                    .Append(error.SelectSingleNode("./kmehr:description", nsmgr).InnerText)
                    .Append(" (")
                    .Append(error.SelectSingleNode("./kmehr:url", nsmgr).InnerText)
                    .AppendLine(")");
                }
                Assert.Inconclusive(errorMsg.ToString());
            }
        }
Пример #5
0
 public NewsPostMaster(SecurityInfo self, ehBoxPublicationPortTypeClient publish, ehBoxConsultationPortTypeClient consult, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.publish = publish;
     this.consult = consult;
 }
Пример #6
0
 public ConsultPostMaster(SecurityInfo self, Chap4AgreementConsultationPortTypeClient proxy, EtkDepotPortTypeClient etkDepot, KgssPortTypeClient kgss)
     : base(self, new SecondPassConsultPostMaster(self, proxy, etkDepot), etkDepot, kgss)
 {
 }
Пример #7
0
 public SecondPassAskPostMaster(SecurityInfo self, Chap4AgreementAdmissionPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Пример #8
0
 public EBirthPostMaster(SecurityInfo self, TTPPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Пример #9
0
 public EBirthPostMaster(SecurityInfo self, TTPPortTypeClient proxy, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.proxy = proxy;
 }
Пример #10
0
 public NewsPostMaster(SecurityInfo self, ehBoxPublicationPortTypeClient publish, ehBoxConsultationPortTypeClient consult, EtkDepotPortTypeClient etkDepot)
     : base(self, etkDepot)
 {
     this.publish = publish;
     this.consult = consult;
 }
Пример #11
0
        public void ConfigDoctorViaCode()
        {
            //Create SSOBinding
            var ssoBinding = new SsoBinding();
            ssoBinding.Security.Mode = WSFederationHttpSecurityMode.Message;
            ssoBinding.Security.Message.IssuedKeyType = SecurityKeyType.AsymmetricKey;
            ssoBinding.Security.Message.NegotiateServiceCredential = false;
            ssoBinding.Security.Message.EstablishSecurityContext = false;

            ssoBinding.Security.Message.IssuerAddress = new EndpointAddress("https://wwwacc.ehealth.fgov.be/sts_1_1/SecureTokenService");
            ssoBinding.Security.Message.IssuerBinding = new StsBinding();

            XmlDocument doc = new XmlDocument();
            doc.LoadXml("<saml:Attribute xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" AttributeNamespace=\"urn:be:fgov:identification-namespace\" AttributeName=\"urn:be:fgov:person:ssin\">" +
                "<saml:AttributeValue xsi:type=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">79021802145</saml:AttributeValue>" +
                "</saml:Attribute>");
            ssoBinding.Security.Message.TokenRequestParameters.Add(doc.DocumentElement);
            doc = new XmlDocument();
            doc.LoadXml("<saml:Attribute xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" AttributeNamespace=\"urn:be:fgov:identification-namespace\" AttributeName=\"urn:be:fgov:ehealth:1.0:certificateholder:person:ssin\">" +
                "<saml:AttributeValue xsi:type=\"xs:string\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">79021802145</saml:AttributeValue>" +
                "</saml:Attribute>");
            ssoBinding.Security.Message.TokenRequestParameters.Add(doc.DocumentElement);

            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:identification-namespace}urn:be:fgov:person:ssin"));
            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:identification-namespace}urn:be:fgov:ehealth:1.0:certificateholder:person:ssin"));
            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:certified-namespace:ehealth}urn:be:fgov:person:ssin:doctor:boolean"));
            ssoBinding.Security.Message.ClaimTypeRequirements.Add(new ClaimTypeRequirement("{urn:be:fgov:certified-namespace:ehealth}urn:be:fgov:person:ssin:ehealth:1.0:doctor:nihii11"));

            //Creating basic https binding
            BasicHttpBinding httpsBinding = new BasicHttpBinding();
            httpsBinding.Security.Mode = BasicHttpSecurityMode.Transport;

            //Create the Consult proxy
            Chap4AgreementConsultationPortTypeClient consult = new Chap4AgreementConsultationPortTypeClient(ssoBinding, new EndpointAddress("https://services-acpt.ehealth.fgov.be/ChapterIV/ChapterIVAgreementConsultation/v1"));
            consult.Endpoint.Behaviors.Remove<ClientCredentials>();
            consult.Endpoint.Behaviors.Add(new SsoClientCredentials());
            consult.Endpoint.Behaviors.Add(new SessionBehavior(session, TimeSpan.FromHours(1), typeof(MemorySessionCache), null));
            consult.ClientCredentials.ClientCertificate.Certificate = auth; //must be put after the behavior

            //Create KGSS proxy
            KgssPortTypeClient kgss = new KgssPortTypeClient(httpsBinding, new EndpointAddress("https://services-acpt.ehealth.fgov.be/Kgss/v1"));

            //Create ETK Depot proxy
            EtkDepotPortTypeClient etkDepot = new EtkDepotPortTypeClient(httpsBinding, new EndpointAddress("https://services-acpt.ehealth.fgov.be/EtkDepot/v1"));

            //Create self
            SecurityInfo self = SecurityInfo.Create(sign, StoreLocation.CurrentUser, etkDepot);

            //Create Consult postmaster
            ConsultPostMaster postmaster = new ConsultPostMaster(self, consult, etkDepot, kgss);
            postmaster.VerifyEtk = false;

            //prepare the input
            InputParameterData parameters = new InputParameterData();
            parameters.CommonInput = new CommonInputType();
            parameters.CommonInput.Request = new RequestType1();
            parameters.CommonInput.Request.IsTest = true;
            parameters.CommonInput.Origin = new OriginType();
            parameters.CommonInput.Origin.Package = new PackageType();
            parameters.CommonInput.Origin.Package.License = new LicenseType();
            //parameters.CommonInput.Origin.Package.License.Username = "******"; //provide you own license
            //parameters.CommonInput.Origin.Package.License.Password = "******"; //provide your own password
            parameters.CommonInput.Origin.Package.License.Username = "******"; //provide you own license
            parameters.CommonInput.Origin.Package.License.Password = "******"; //provide your own password

            parameters.CommonInput.Origin.CareProvider = new CareProviderType();
            parameters.CommonInput.Origin.CareProvider.Nihii = new NihiiType();
            parameters.CommonInput.Origin.CareProvider.Nihii.Quality = "doctor";
            parameters.CommonInput.Origin.CareProvider.Nihii.Value = new ValueRefString();
            parameters.CommonInput.Origin.CareProvider.Nihii.Value.Value = "19997341001";
            parameters.CommonInput.Origin.CareProvider.PhysicalPerson = new IdType();
            parameters.CommonInput.Origin.CareProvider.PhysicalPerson.Ssin = new ValueRefString();
            parameters.CommonInput.Origin.CareProvider.PhysicalPerson.Ssin.Value = "79021802145";
            parameters.RecordCommonInput = new RecordCommonInputType();
            parameters.RecordCommonInput.InputReferenceSpecified = true;
            parameters.RecordCommonInput.InputReference = 20101112100503;
            parameters.AgreementStartDate = new DateTime(2013, 04, 01, 0, 0, 0, DateTimeKind.Utc);
            parameters.CareReceiverId = new CareReceiverIdType();
            parameters.CareReceiverId.Ssin = "01093008501";

            //send the request
            X509Certificate2 sender;
            Tuple<Stream, OutputParameterData> response = postmaster.Transfer(new FileStream("request_consult_physician.xml", FileMode.Open), parameters, out sender);

            WriteFormattedXml(response.Item1);

            //Chech for business responses
            XmlDocument responseDoc = new XmlDocument();
            XmlNamespaceManager nsmgr =  new XmlNamespaceManager(responseDoc.NameTable);
            nsmgr.AddNamespace("ns", "http://www.ehealth.fgov.be/medicalagreement/core/v1");
            nsmgr.AddNamespace("kmehr", "http://www.ehealth.fgov.be/standards/kmehr/schema/v1");
            responseDoc.Load(response.Item1);
            XmlNodeList errorList = responseDoc.SelectNodes("/ns:kmehrresponse/ns:acknowledge/ns:error", nsmgr);
            if (errorList.Count > 0)
            {
                StringBuilder errorMsg = new StringBuilder();
                foreach (XmlNode error in errorList)
                {
                    errorMsg.Append(error.SelectSingleNode("./kmehr:cd", nsmgr).InnerText)
                        .Append(": ")
                        .Append(error.SelectSingleNode("./kmehr:description", nsmgr).InnerText)
                        .Append(" (")
                        .Append(error.SelectSingleNode("./kmehr:url", nsmgr).InnerText)
                        .AppendLine(")");
                }
                Assert.Inconclusive(errorMsg.ToString());
            }
        }
Пример #12
0
 public ConsultPostMaster(SecurityInfo self, Chap4AgreementConsultationPortTypeClient proxy, EtkDepotPortTypeClient etkDepot, KgssPortTypeClient kgss)
     : base(self, new SecondPassConsultPostMaster(self, proxy, etkDepot), etkDepot, kgss)
 {
 }