Produced by Araxis Merge on 12/5/2017 12:06:40 PM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\FederationDataSourceProvider\main\src\java\gov\va\med\imaging\federation\proxy | FederationProxyUtilities.java | Mon Dec 4 21:35:10 2017 UTC |
| 2 | IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\FederationDataSourceProvider\main\src\java\gov\va\med\imaging\federation\proxy | FederationProxyUtilities.java | Tue Dec 5 13:02:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 542 |
| Changed | 3 | 8 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /** | |
| 2 | * | |
| 3 | Package: MAG - Vis tA Imaging | |
| 4 | WARNING: Per VHA D irective 2 004-038, t his routin e should n ot be modi fied. | |
| 5 | Date Cre ated: May 7, 2008 | |
| 6 | Site Nam e: Washin gton OI Fi eld Office , Silver S pring, MD | |
| 7 | Developer:
|
|
| 8 | Descript ion: | |
| 9 | ||
| 10 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 11 | ;; Property of the US Government . | |
| 12 | ;; No permis sion to co py or redi stribute t his softwa re is give n. | |
| 13 | ;; Use of un released v ersions of this soft ware requi res the us er | |
| 14 | ;; to execu te a writt en test ag reement wi th the Vis tA Imaging | |
| 15 | ;; Developm ent Office of the De partment o f Veterans Affairs, | |
| 16 | ;; telephon e (301) 73 4-0100. | |
| 17 | ;; | |
| 18 | ;; The Food and Drug A dministrat ion classi fies this software a s | |
| 19 | ;; a Class I I medical device. A s such, it may not b e changed | |
| 20 | ;; in any wa y. Modifi cations to this soft ware may r esult in a n | |
| 21 | ;; adulterat ed medical device un der 21CFR8 20, the us e of which | |
| 22 | ;; is consid ered to be a violati on of US F ederal Sta tutes. | |
| 23 | ;; +-------- ---------- ---------- ---------- ---------- ---------- ---------- + | |
| 24 | ||
| 25 | */ | |
| 26 | package go v.va.med.i maging.fed eration.pr oxy; | |
| 27 | ||
| 28 | import jav a.net.Malf ormedURLEx ception; | |
| 29 | import jav a.net.URL; | |
| 30 | import jav a.security .Provider; | |
| 31 | import jav a.util.Set ; | |
| 32 | import jav a.util.Sor tedSet; | |
| 33 | ||
| 34 | import jav ax.net.ssl .TrustMana ger; | |
| 35 | import jav ax.net.ssl .TrustMana gerFactory ; | |
| 36 | ||
| 37 | import org .apache.co mmons.http client.pro tocol.Prot ocol; | |
| 38 | import org .apache.co mmons.http client.pro tocol.Prot ocolSocket Factory; | |
| 39 | import org .apache.lo gging.log4 j.LogManag er; | |
| 40 | import org .apache.lo gging.log4 j.Logger; | |
| 41 | ||
| 42 | import gov .va.med.im aging.exch ange.busin ess.Site; | |
| 43 | import gov .va.med.im aging.fede rationdata source.con figuration .Federatio nConfigura tion; | |
| 44 | import gov .va.med.im aging.prox y.ImagingP roxy; | |
| 45 | import gov .va.med.im aging.prox y.ids.IDSO peration; | |
| 46 | import gov .va.med.im aging.prox y.ids.IDSP roxy; | |
| 47 | import gov .va.med.im aging.prox y.ids.IDSS ervice; | |
| 48 | import gov .va.med.im aging.prox y.services .ProxyServ ices; | |
| 49 | import gov .va.med.im aging.prox y.ssl.Auth SSLProtoco lSocketFac tory; | |
| 50 | ||
| 51 | /** | |
| 52 | * Common utilities for all Fe deration d ata source s | |
| 53 | * | |
| 54 | * @author
|
|
| 55 | * | |
| 56 | */ | |
| 57 | public cla ss Federat ionProxyUt ilities | |
| 58 | { | |
| 59 | pr ivate fina l static I DSProxy ve rsionProxy = new IDS Proxy(); | |
| 60 | pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Fede rationProx yUtilities .class); | |
| 61 | pr ivate fina l static S tring def aultFedera tionProtoc ol = "http s"; | |
| 62 | ||
| 63 | pu blic final static in t defaultF ederationS slPort = PORT ; | |
| 64 | pu blic final static in t defaultF ederationS slNioPort = PORT ; | |
| 65 | pu blic final static in t starting NioVersion = 8; | |
| 66 | ||
| 67 | /* * | |
| 68 | * Configure the Feder ation cert ificate pr otocol to use certif icates to communicat e with rem ote server | |
| 69 | * @param fe derationCo nfiguratio n The conf iguration for the fe deration d ata source | |
| 70 | * / | |
| 71 | pu blic stati c void con figureFede rationCert ificate(Fe derationCo nfiguratio n federati onConfigur ation) | |
| 72 | { | |
| 73 | try | |
| 74 | { | |
| 75 | URL keysto reUrl = ne w URL(fede rationConf iguration. getKeystor eUrl()); // t he keystor e containi ng the key to send a s the clie nt | |
| 76 | URL trusts toreUrl = new URL(fe derationCo nfiguratio n.getTrust storeUrl() ); // t he keystor e containi ng the tru sted certi ficates, t o validate the serve r cert aga inst | |
| 77 | ||
| 78 | ProtocolSo cketFactor y socketFa ctory = | |
| 79 | new Au thSSLProto colSocketF actory(key storeUrl, | |
| 80 | federati onConfigur ation.getK eystorePas sword(), t ruststoreU rl, | |
| 81 | federati onConfigur ation.getT ruststoreP assword()) ; | |
| 82 | ||
| 83 | Protoc ol httpsPr otocol = n ew Protoco l(defaultF ederationP rotocol, s ocketFacto ry, defaul tFederatio nSslPort); | |
| 84 | Protocol.r egisterPro tocol(fede rationConf iguration. getFederat ionSslProt ocol(), ht tpsProtoco l); | |
| 85 | LogManager .getLogger (Federatio nProxyUtil ities.clas s).info("F ederation HTTPS prot ocol handl er success fully regi stered."); | |
| 86 | dumpSSLPro perties(); | |
| 87 | } | |
| 88 | catc h (Malform edURLExcep tion e) | |
| 89 | { | |
| 90 | LogManager .getLogger (ImagingPr oxy.class) .error( | |
| 91 | "E rror confi guring HTT PS client within fed eration pr oxy. \n" + | |
| 92 | "K eystore an d/or trust store are unavailabl e. \n" + | |
| 93 | "F ederation functional ity will n ot be avai lable."); | |
| 94 | } | |
| 95 | } | |
| 96 | ||
| 97 | /* * | |
| 98 | * Helper co de to outp ut the SSL propertie s loaded f rom the ke ystore/tru ststore | |
| 99 | * / | |
| 100 | pr ivate stat ic void du mpSSLPrope rties() | |
| 101 | ||
| 102 | { | |
| 103 | St ring defau ltAlgorith m = null; | |
| 104 | ja vax.net.ss l.KeyManag erFactory keyMgrFact ory = null ; | |
| 105 | Pr ovider pro vider = nu ll; | |
| 106 | Se t<Object> keySet = n ull; | |
| 107 | ja vax.net.ss l.KeyManag er[] keyMa nagers = n ull; | |
| 108 | Sy stem.out.p rintln("== ========== ======== S SL Propert ies ====== ========== ========== ========== =="); | |
| 109 | tr y | |
| 110 | { | |
| 111 | defa ultAlgorit hm = javax .net.ssl.K eyManagerF actory.get DefaultAlg orithm(); | |
| 112 | Syst em.out.pri ntln("Defa ult Algori thm is '" + defaultA lgorithm + "'"); | |
| 113 | } | |
| 114 | ca tch (Throw able x) | |
| 115 | { | |
| 116 | Syst em.out.pri ntln("Erro r (" + x.g etMessage( ) + ") get ting defau lt algorit hm"); | |
| 117 | } | |
| 118 | tr y | |
| 119 | { | |
| 120 | keyM grFactory = javax.ne t.ssl.KeyM anagerFact ory.getIns tance(defa ultAlgorit hm); | |
| 121 | Syst em.out.pri ntln("KeyM anagerFact ory type i s '" + key MgrFactory .getClass( ).getSimpl eName() + "'"); | |
| 122 | } | |
| 123 | ca tch (Throw able x) | |
| 124 | { | |
| 125 | Syst em.out.pri ntln("Erro r (" + x.g etMessage( ) + ") get ting key m anager fac tory"); | |
| 126 | } | |
| 127 | tr y | |
| 128 | { | |
| 129 | prov ider = key MgrFactory .getProvid er(); | |
| 130 | Syst em.out.pri ntln("KeyM anagerFact ory Provid er type is '" + prov ider.getCl ass().getS impleName( ) + "'"); | |
| 131 | } | |
| 132 | ca tch (Throw able x) | |
| 133 | { | |
| 134 | Syst em.out.pri ntln("Erro r (" + x.g etMessage( ) + ") get ting provi der"); | |
| 135 | } | |
| 136 | Sy stem.out.p rintln("== ========== ======= Tr ustManager Factory.PK IX Trust M anagers == ========== ========== ===="); | |
| 137 | tr y | |
| 138 | { | |
| 139 | Obje ct provide rValue = p rovider.ge t("TrustMa nagerFacto ry.PKIX"); | |
| 140 | Trus tManagerFa ctory pkix TrustMgrFa ctory = (T rustManage rFactory)p roviderVal ue; | |
| 141 | Trus tManager[] pkixTrust managers = pkixTrust MgrFactory .getTrustM anagers(); | |
| 142 | for (TrustMana ger pkixTr ustManager : pkixTru stmanagers ) | |
| 143 | System .out.print ln("Provid er " + pki xTrustMana ger.toStri ng() ); | |
| 144 | } | |
| 145 | ca tch (Throw able x) | |
| 146 | { | |
| 147 | Syst em.out.pri ntln("Erro r (" + x.g etMessage( ) + ") get ting Trust ManagerFac tory.PKIX value"); | |
| 148 | } | |
| 149 | Sy stem.out.p rintln("== ========== ======= Tr ustManager Factory.PK IX Trust M anagers == ========== ========== ===="); | |
| 150 | tr y | |
| 151 | { | |
| 152 | keyS et = provi der.keySet (); | |
| 153 | for (Object ke y : keySet ) | |
| 154 | System .out.print ln("Provid er [" + ke y.toString () + "] [" + provide r.get(key) .toString( ) + "]" ); | |
| 155 | } | |
| 156 | ca tch (Throw able x) | |
| 157 | { | |
| 158 | Syst em.out.pri ntln("Erro r (" + x.g etMessage( ) + ") get ting provi der keyset "); | |
| 159 | } | |
| 160 | tr y | |
| 161 | { | |
| 162 | keyM anagers = keyMgrFact ory.getKey Managers() ; | |
| 163 | for (javax.net .ssl.KeyMa nager keyM anager : k eyManagers ) | |
| 164 | System .out.print ln("KeyMan ager [" + keyManager .getClass( ).getSimpl eName() + "]" ); | |
| 165 | } | |
| 166 | ca tch (Throw able x) | |
| 167 | { | |
| 168 | Syst em.out.pri ntln("Erro r (" + x.g etMessage( ) + ") get ting key m anagers"); | |
| 169 | } | |
| 170 | Sy stem.out.p rintln("== ========== ======== E nd SSL Pro perties == ========== ========== ========== ======"); | |
| 171 | } | |
| 172 | ||
| 173 | /* * | |
| 174 | * | |
| 175 | * @param si te | |
| 176 | * @param se rviceName | |
| 177 | * @param da tasourceVe rsion | |
| 178 | * @return | |
| 179 | * / | |
| 180 | pu blic stati c ProxySer vices getF ederationP roxyServic es(Site si te, String serviceNa me, String datasourc eVersion) | |
| 181 | { | |
| 182 | // g et the ser vice from the IDS on the remot e web app | |
| 183 | Sort edSet<IDSS ervice> se rvices = v ersionProx y.getImagi ngServices (site, ser viceName, datasource Version); | |
| 184 | // i f nothing is returne d, then th ere are no facades t o service this versi on | |
| 185 | if(( services = = null) || (services .size() <= 0)) | |
| 186 | { | |
| 187 | logger .warn("Got null serv ices back from IDS s ervice for site [" + site.getS iteNumber( ) + "], in dicates re mote site does not h ave a VIX. Cannot us e Federati on for thi s site"); | |
| 188 | return null; | |
| 189 | } | |
| 190 | ||
| 191 | IDSS ervice ser vice = ser vices.firs t(); | |
| 192 | ||
| 193 | Prox yServices proxyServi ces = new ProxyServi ces(); | |
| 194 | ||
| 195 | for( IDSOperati on operati on : servi ce.getOper ations()) | |
| 196 | { | |
| 197 | proxyS ervices.ad d(new Fede rationProx yService(s ervice, op eration, s ite.getAcc eleratorSe rver(), de faultFeder ationSslPo rt)); | |
| 198 | } | |
| 199 | ||
| 200 | retu rn proxySe rvices; | |
| 201 | } | |
| 202 | ||
| 203 | /* * | |
| 204 | * | |
| 205 | * @param si te | |
| 206 | * @param se rviceName | |
| 207 | * @return | |
| 208 | * / | |
| 209 | pu blic stati c ProxySer vices getC urrentFede rationProx yServices( Site site, String se rviceName) | |
| 210 | { | |
| 211 | // g et the ser vice from the IDS on the remot e web app | |
| 212 | Sort edSet<IDSS ervice> se rvices = v ersionProx y.getImagi ngServices (site, ser viceName, ""); | |
| 213 | ||
| 214 | // i f nothing is returne d, then th ere are no facades t o service this versi on | |
| 215 | if(( services = = null) || (services .size() <= 0)) | |
| 216 | { | |
| 217 | logger .warn("Got null serv ices back from IDS s ervice for site [" + site.getS iteNumber( ) + "], in dicates re mote site does not h ave a VIX. Cannot us e Federati on for thi s site"); | |
| 218 | return null; | |
| 219 | } | |
| 220 | ||
| 221 | IDSS ervice ser vice = ser vices.firs t(); | |
| 222 | ||
| 223 | logg er.debug(" Current Fe deration I DSService version: " + service .getVersio n()); | |
| 224 | ||
| 225 | int version = Integer.pa rseInt(ser vice.getVe rsion()); | |
| 226 | int port = (ve rsion < st artingNioV ersion) ? defaultFed erationSsl Port : def aultFedera tionSslNio Port; | |
| 227 | ||
| 228 | Prox yServices proxyServi ces = new ProxyServi ces(); | |
| 229 | ||
| 230 | for( IDSOperati on operati on : servi ce.getOper ations()) | |
| 231 | { | |
| 232 | proxyS ervices.ad d(new Fede rationProx yService(s ervice, op eration, s ite.getAcc eleratorSe rver(), po rt)); | |
| 233 | } | |
| 234 | ||
| 235 | retu rn proxySe rvices; | |
| 236 | } | |
| 237 | ||
| 238 | pu blic stati c ProxySer vices getC urrentFede rationProx yServices( | |
| 239 | IDSSer vice servi ce, | |
| 240 | Site s ite) | |
| 241 | { | |
| 242 | int version = Integer.pa rseInt(ser vice.getVe rsion()); | |
| 243 | int port = (ve rsion < st artingNioV ersion) ? defaultFed erationSsl Port : def aultFedera tionSslNio Port; | |
| 244 | ||
| 245 | Prox yServices proxyServi ces = new ProxyServi ces(); | |
| 246 | ||
| 247 | for( IDSOperati on operati on : servi ce.getOper ations()) | |
| 248 | { | |
| 249 | proxyS ervices.ad d(new Fede rationProx yService(s ervice, op eration, s ite.getAcc eleratorSe rver(), po rt)); | |
| 250 | } | |
| 251 | ||
| 252 | retu rn proxySe rvices; | |
| 253 | } | |
| 254 | ||
| 255 | ||
| 256 | pu blic stati c IDSServi ce getIDSS ervice(Sit e site, St ring servi ceName) | |
| 257 | { | |
| 258 | // g et the ser vice from the IDS on the remot e web app | |
| 259 | Sort edSet<IDSS ervice> se rvices = v ersionProx y.getImagi ngServices (site, ser viceName, ""); | |
| 260 | ||
| 261 | // i f nothing is returne d, then th ere are no facades t o service this versi on | |
| 262 | if(( services = = null) || (services .size() <= 0)) | |
| 263 | { | |
| 264 | logger .warn("Got null serv ices back from IDS s ervice for site [" + site.getS iteNumber( ) + "], in dicates re mote site does not h ave a VIX. Cannot us e Federati on for thi s site"); | |
| 265 | return null; | |
| 266 | } | |
| 267 | ||
| 268 | IDSS ervice ser vice = ser vices.firs t(); | |
| 269 | logg er.debug(" Current Fe deration I DSService version: " + service .getVersio n()); | |
| 270 | ||
| 271 | retu rn service ; | |
| 272 | } | |
| 273 | ||
| 274 | ||
| 275 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.