1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 | package gov.hhs.fha.nhinc.subjectdiscovery;
|
---|
6 |
|
---|
7 | import com.sun.xml.wss.SubjectAccessor;
|
---|
8 | import com.sun.xml.wss.XWSSecurityException;
|
---|
9 | import com.sun.xml.wss.impl.XWSSecurityRuntimeException;
|
---|
10 | import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
|
---|
11 | import gov.hhs.fha.nhinc.nhinclib.NullChecker;
|
---|
12 | import gov.hhs.fha.nhinc.nhincsubjectdiscovery.NhincSubjectDiscoveryPortType;
|
---|
13 | import gov.hhs.fha.nhinc.nhincsubjectdiscovery.NhincSubjectDiscoveryService;
|
---|
14 | import javax.xml.ws.WebServiceContext;
|
---|
15 | import org.hl7.v3.*;
|
---|
16 | import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractor;
|
---|
17 | import gov.hhs.fha.nhinc.saml.extraction.SamlTokenExtractorHelper;
|
---|
18 | import java.util.Set;
|
---|
19 | import javax.security.auth.Subject;
|
---|
20 | import javax.xml.stream.XMLStreamReader;
|
---|
21 | import org.apache.commons.logging.Log;
|
---|
22 | import org.apache.commons.logging.LogFactory;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | *
|
---|
26 | * @author Jon Hoppesch
|
---|
27 | */
|
---|
28 | public class SubjectDiscoveryImpl {
|
---|
29 |
|
---|
30 | private static Log log = LogFactory.getLog(SubjectDiscoveryImpl.class);
|
---|
31 |
|
---|
32 | public static MCCIIN000002UV01 pixConsumerPRPAIN201301UV(PRPAIN201301UV message, WebServiceContext context) {
|
---|
33 | log.debug("Entering SubjectDiscoveryImpl.pixConsumerPRPAIN201301UV");
|
---|
34 |
|
---|
35 | MCCIIN000002UV01 ackMsg = new MCCIIN000002UV01();
|
---|
36 | PIXConsumerPRPAIN201301UVRequestType pix201301Request = new PIXConsumerPRPAIN201301UVRequestType();
|
---|
37 |
|
---|
38 | // Determine the receiving home community id
|
---|
39 | String homeCommunityId = null;
|
---|
40 | if (message.getReceiver() != null &&
|
---|
41 | message.getReceiver().size() > 0 &&
|
---|
42 | message.getReceiver().get(0) != null &&
|
---|
43 | message.getReceiver().get(0).getDevice() != null &&
|
---|
44 | message.getReceiver().get(0).getDevice().getId() != null &&
|
---|
45 | message.getReceiver().get(0).getDevice().getId().size() > 0 &&
|
---|
46 | message.getReceiver().get(0).getDevice().getId().get(0) != null &&
|
---|
47 | NullChecker.isNotNullish(message.getReceiver().get(0).getDevice().getId().get(0).getRoot())) {
|
---|
48 | homeCommunityId = message.getReceiver().get(0).getDevice().getId().get(0).getRoot();
|
---|
49 | }
|
---|
50 |
|
---|
51 | pix201301Request.setPRPAIN201301UV(message);
|
---|
52 | pix201301Request.setAssertion(SamlTokenExtractor.GetAssertion(context));
|
---|
53 |
|
---|
54 | NhincSubjectDiscoveryService service = new NhincSubjectDiscoveryService();
|
---|
55 | NhincSubjectDiscoveryPortType port = service.getNhincSubjectDiscoveryPortSoap11();
|
---|
56 | ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_SUBJECT_DISCOVERY));
|
---|
57 |
|
---|
58 | ackMsg = port.pixConsumerPRPAIN201301UV(pix201301Request);
|
---|
59 |
|
---|
60 | log.debug("Exiting SubjectDiscoveryImpl.pixConsumerPRPAIN201301UV");
|
---|
61 | return ackMsg;
|
---|
62 | }
|
---|
63 |
|
---|
64 | public static MCCIIN000002UV01 pixConsumerPRPAIN201302UV(PRPAIN201302UV message, WebServiceContext context) {
|
---|
65 | log.debug("Entering SubjectDiscoveryImpl.pixConsumerPRPAIN201302UV");
|
---|
66 |
|
---|
67 | MCCIIN000002UV01 ackMsg = new MCCIIN000002UV01();
|
---|
68 | PIXConsumerPRPAIN201302UVRequestType pix201302Request = new PIXConsumerPRPAIN201302UVRequestType();
|
---|
69 |
|
---|
70 | pix201302Request.setPRPAIN201302UV(message);
|
---|
71 | pix201302Request.setAssertion(SamlTokenExtractor.GetAssertion(context));
|
---|
72 |
|
---|
73 | // Determine the receiving home community id
|
---|
74 | String homeCommunityId = null;
|
---|
75 | if (message.getReceiver() != null &&
|
---|
76 | message.getReceiver().size() > 0 &&
|
---|
77 | message.getReceiver().get(0) != null &&
|
---|
78 | message.getReceiver().get(0).getDevice() != null &&
|
---|
79 | message.getReceiver().get(0).getDevice().getId() != null &&
|
---|
80 | message.getReceiver().get(0).getDevice().getId().size() > 0 &&
|
---|
81 | message.getReceiver().get(0).getDevice().getId().get(0) != null &&
|
---|
82 | NullChecker.isNotNullish(message.getReceiver().get(0).getDevice().getId().get(0).getRoot())) {
|
---|
83 | homeCommunityId = message.getReceiver().get(0).getDevice().getId().get(0).getRoot();
|
---|
84 | }
|
---|
85 |
|
---|
86 | NhincSubjectDiscoveryService service = new NhincSubjectDiscoveryService();
|
---|
87 | NhincSubjectDiscoveryPortType port = service.getNhincSubjectDiscoveryPortSoap11();
|
---|
88 | ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_SUBJECT_DISCOVERY));
|
---|
89 |
|
---|
90 | ackMsg = port.pixConsumerPRPAIN201302UV(pix201302Request);
|
---|
91 |
|
---|
92 | log.debug("Exiting SubjectDiscoveryImpl.pixConsumerPRPAIN201302UV");
|
---|
93 | return ackMsg;
|
---|
94 | }
|
---|
95 |
|
---|
96 | public static MCCIIN000002UV01 pixConsumerPRPAIN201303UV(PRPAIN201303UV message, WebServiceContext context) {
|
---|
97 | log.debug("Entering SubjectDiscoveryImpl.pixConsumerPRPAIN201303UV");
|
---|
98 |
|
---|
99 | MCCIIN000002UV01 ackMsg = new MCCIIN000002UV01();
|
---|
100 | PIXConsumerPRPAIN201303UVRequestType pix201303Request = new PIXConsumerPRPAIN201303UVRequestType();
|
---|
101 |
|
---|
102 | pix201303Request.setPRPAIN201303UV(message);
|
---|
103 | pix201303Request.setAssertion(SamlTokenExtractor.GetAssertion(context));
|
---|
104 |
|
---|
105 | // Determine the receiving home community id
|
---|
106 | String homeCommunityId = null;
|
---|
107 | if (message.getReceiver() != null &&
|
---|
108 | message.getReceiver().size() > 0 &&
|
---|
109 | message.getReceiver().get(0) != null &&
|
---|
110 | message.getReceiver().get(0).getDevice() != null &&
|
---|
111 | message.getReceiver().get(0).getDevice().getId() != null &&
|
---|
112 | message.getReceiver().get(0).getDevice().getId().size() > 0 &&
|
---|
113 | message.getReceiver().get(0).getDevice().getId().get(0) != null &&
|
---|
114 | NullChecker.isNotNullish(message.getReceiver().get(0).getDevice().getId().get(0).getRoot())) {
|
---|
115 | homeCommunityId = message.getReceiver().get(0).getDevice().getId().get(0).getRoot();
|
---|
116 | }
|
---|
117 |
|
---|
118 | NhincSubjectDiscoveryService service = new NhincSubjectDiscoveryService();
|
---|
119 | NhincSubjectDiscoveryPortType port = service.getNhincSubjectDiscoveryPortSoap11();
|
---|
120 | ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_SUBJECT_DISCOVERY));
|
---|
121 |
|
---|
122 | ackMsg = port.pixConsumerPRPAIN201303UV(pix201303Request);
|
---|
123 |
|
---|
124 | log.debug("Exiting SubjectDiscoveryImpl.pixConsumerPRPAIN201303UV");
|
---|
125 | return ackMsg;
|
---|
126 | }
|
---|
127 |
|
---|
128 | public static MCCIIN000002UV01 pixConsumerPRPAIN201304UV(PRPAIN201304UV message, WebServiceContext context) {
|
---|
129 | //TODO implement this method
|
---|
130 | throw new UnsupportedOperationException("Not implemented yet.");
|
---|
131 | }
|
---|
132 |
|
---|
133 | static PRPAIN201310UV pixConsumerPRPAIN201309UV(PRPAIN201309UV message, WebServiceContext context) {
|
---|
134 | log.debug("Entering SubjectDiscoveryImpl.pixConsumerPRPAIN201309UV");
|
---|
135 |
|
---|
136 | PRPAIN201310UV ret310 = new PRPAIN201310UV();
|
---|
137 | PIXConsumerPRPAIN201309UVRequestType pix201309Request = new PIXConsumerPRPAIN201309UVRequestType();
|
---|
138 |
|
---|
139 | pix201309Request.setPRPAIN201309UV(message);
|
---|
140 | pix201309Request.setAssertion(SamlTokenExtractor.GetAssertion(context));
|
---|
141 |
|
---|
142 | // Determine the receiving home community id
|
---|
143 | String homeCommunityId = null;
|
---|
144 | if (message.getReceiver() != null &&
|
---|
145 | message.getReceiver().size() > 0 &&
|
---|
146 | message.getReceiver().get(0) != null &&
|
---|
147 | message.getReceiver().get(0).getDevice() != null &&
|
---|
148 | message.getReceiver().get(0).getDevice().getId() != null &&
|
---|
149 | message.getReceiver().get(0).getDevice().getId().size() > 0 &&
|
---|
150 | message.getReceiver().get(0).getDevice().getId().get(0) != null &&
|
---|
151 | NullChecker.isNotNullish(message.getReceiver().get(0).getDevice().getId().get(0).getRoot())) {
|
---|
152 | homeCommunityId = message.getReceiver().get(0).getDevice().getId().get(0).getRoot();
|
---|
153 | }
|
---|
154 |
|
---|
155 | NhincSubjectDiscoveryService service = new NhincSubjectDiscoveryService();
|
---|
156 | NhincSubjectDiscoveryPortType port = service.getNhincSubjectDiscoveryPortSoap11();
|
---|
157 | ((javax.xml.ws.BindingProvider) port).getRequestContext().put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, SamlTokenExtractorHelper.getEndpointURL(homeCommunityId, SamlTokenExtractorHelper.INTERNAL_SUBJECT_DISCOVERY));
|
---|
158 |
|
---|
159 | ret310 = port.pixConsumerPRPAIN201309UV(pix201309Request).getPRPAIN201310UV();
|
---|
160 |
|
---|
161 | log.debug("Exiting SubjectDiscoveryImpl.pixConsumerPRPAIN201309UV");
|
---|
162 | return ret310;
|
---|
163 | }
|
---|
164 |
|
---|
165 | }
|
---|