Produced by Araxis Merge on 1/17/2019 10:54:40 AM 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 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\via\sts\service | StsHeaderHandler.java | Wed Jan 16 16:06:46 2019 UTC |
| 2 | v1_iter_1_VIP_Build_4_Dec_2018_CG.zip\v1_iter_1_VIP_Build_4\portlets\caret-portlet\docroot\WEB-INF\src\gov\via\sts\service | StsHeaderHandler.java | Wed Jan 16 21:20:33 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 232 |
| Changed | 3 | 6 |
| 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 | package go v.via.sts. service; | |
| 2 | ||
| 3 | import jav a.io.ByteA rrayOutput Stream; | |
| 4 | import jav a.util.Ite rator; | |
| 5 | import jav a.util.Set ; | |
| 6 | import jav ax.xml.nam espace.QNa me; | |
| 7 | import jav ax.xml.soa p.SOAPBody ; | |
| 8 | import jav ax.xml.soa p.SOAPBody Element; | |
| 9 | import jav ax.xml.soa p.SOAPElem ent; | |
| 10 | import jav ax.xml.soa p.SOAPEnve lope; | |
| 11 | import jav ax.xml.soa p.SOAPHead er; | |
| 12 | import jav ax.xml.soa p.SOAPMess age; | |
| 13 | import jav ax.xml.ws. handler.Me ssageConte xt; | |
| 14 | import jav ax.xml.ws. handler.so ap.SOAPHan dler; | |
| 15 | import jav ax.xml.ws. handler.so ap.SOAPMes sageContex t; | |
| 16 | ||
| 17 | import com .liferay.p ortal.kern el.log.Log ; | |
| 18 | import com .liferay.p ortal.kern el.log.Log FactoryUti l; | |
| 19 | import com .liferay.p ortal.serv ice.Servic eContext; | |
| 20 | import com .liferay.p ortal.serv ice.Servic eContextTh readLocal; | |
| 21 | import com .liferay.p ortal.util .PortalUti l; | |
| 22 | ||
| 23 | public cla ss StsHead erHandler implements SOAPHandl er<SOAPMes sageContex t> { | |
| 24 | pr ivate stat ic final L og _log = LogFactory Util.getLo g( StsHead erHandler. class ); | |
| 25 | ||
| 26 | public boolean h andleMessa ge(SOAPMes sageContex t smc) { | |
| 27 | ||
| 28 | Bo olean outb oundProper ty = (Bool ean) smc.g et(Message Context.ME SSAGE_OUTB OUND_PROPE RTY); | |
| 29 | ||
| 30 | if (outbound Property.b ooleanValu e()) { | |
| 31 | ||
| 32 | SOAPMess age messag e = smc.ge tMessage() ; | |
| 33 | ||
| 34 | try { | |
| 35 | ||
| 36 | SOAP Envelope e nvelope = smc.getMes sage().get SOAPPart() .getEnvelo pe(); | |
| 37 | ||
| 38 | SOAP Header hea der = enve lope.getHe ader(); | |
| 39 | if(h eader == n ull){ | |
| 40 | header = e nvelope.ad dHeader(); | |
| 41 | } | |
| 42 | SOAP Body body = envelope .getBody() ; | |
| 43 | Iter ator<SOAPB odyElement > childEle ments = bo dy.getChil dElements( ); | |
| 44 | whil e (childEl ements.has Next()) { | |
| 45 | SOAPBodyEl ement chil dNode = ch ildElement s.next(); | |
| 46 | if (childN ode.getNod eName().co ntains("Re questSecur ityToken") ) { | |
| 47 | ||
| 48 | Servic eContext s c = Servic eContextTh readLocal. getService Context(); | |
| 49 | String iamSessio n = gov.va .caret.uti l.CaretUti l.getExpan doValue(Po rtalUtil.g etUser(sc. getLiferay PortletReq uest()).ge tExpandoBr idge(), "I AMSESSION" ); | |
| 50 | _log.i nfo("IamSe ssion " + iamSession ); | |
| 51 | childN ode.addNam espaceDecl aration("n s1", "http ://docs.oa sis-open.o rg/ws-sx/w s-trust/20 0512"); | |
| 52 | SOAPEl ement onBe halfOf = | |
| 53 | childNode .addChildE lement("On BehalfOf", "ns1"); | |
| 54 | SOAPEl ement base = | |
| 55 | onBehalfOf .addChildE lement("Ba se", "ns1" ); | |
| 56 | ||
| 57 | SOAPE lement bin arySecurit yToken = | |
| 58 | base.addC hildElemen t("BinaryS ecurityTok en", "wss" , "http:// docs.oasis -open.org/ wss/2004/0 1/oasis-20 0401-wss-w ssecurity- secext-1.0 .xsd"); | |
| 59 | binar ySecurityT oken.addAt tribute(ne w QName("E ncodingTyp e"), "base 64"); | |
| 60 | binarySecu rityToken. addAttribu te(new QNa me("ValueT ype"), "ht tp:// DNS . URL /siteminde r/std_toke n"); | |
| 61 | ||
| 62 | binar ySecurityT oken.addTe xtNode(iam Session); | |
| 63 | ||
| 64 | SOAPEl ement appl iesTo = | |
| 65 | childNode. addChildEl ement("App liesTo", " wsp", "htt p://schema s.xmlsoap. org/ws/200 4/09/polic y"); | |
| 66 | SOAPEl ement endp ointRefere nce = | |
| 67 | appliesTo. addChildEl ement("End pointRefer ence", "ws a", "http: //schemas. xmlsoap.or g/ws/2004/ 08/address ing"); | |
| 68 | SOAPEl ement appl iesToadres s = | |
| 69 | endpointRe ference.ad dChildElem ent("Addre ss", "wsa" ); | |
| 70 | appliesToa dress.addT extNode("h ttps:// DNS . URL "); | |
| 71 | ||
| 72 | SOAPElem ent issuer =childNod e.addChild Element("I ssuer", "n s1"); | |
| 73 | SOAPEl ement adre ss = | |
| 74 | issuer.add ChildEleme nt("Addres s", "wsa", "http://s chemas.xml soap.org/w s/2004/08/ addressing "); | |
| 75 | adress.add TextNode(" https:// DNS . URL /Issuer/sm token/SAML 2"); | |
| 76 | ||
| 77 | SOAPEl ement requ estType =c hildNode.a ddChildEle ment("Requ estType", "ns1"); | |
| 78 | reques tType.addT extNode("h ttp://sche mas.xmlsoa p.org/ws/2 005/02/tru st/Issue") ; | |
| 79 | ||
| 80 | SOAPEl ement toke nType =chi ldNode.add ChildEleme nt("TokenT ype", "ns1 "); | |
| 81 | tokenT ype.addTex tNode("htt p://docs.o asis-open. org/wss/oa sis-wss-sa ml-token-p rofile-1.1 #SAMLV2.0" ); | |
| 82 | break; | |
| 83 | } | |
| 84 | } | |
| 85 | ||
| 86 | } catch (Exception e) { | |
| 87 | _log .error(e); | |
| 88 | } | |
| 89 | ||
| 90 | } else { | |
| 91 | try { | |
| 92 | SOAP Message me ssage = sm c.getMessa ge(); | |
| 93 | Byte ArrayOutpu tStream ou t = new By teArrayOut putStream( ); | |
| 94 | mess age.writeT o(out); | |
| 95 | Stri ng STSResp onseXML = new String (out.toByt eArray()); | |
| 96 | Serv iceContext sc = Serv iceContext ThreadLoca l.getServi ceContext( ); | |
| 97 | sc.g etLiferayP ortletRequ est().setA ttribute(" STSRespons eXML", STS ResponseXM L); | |
| 98 | _log .info("STS Response" + STSResp onseXML); | |
| 99 | ||
| 100 | } catch (Exception ex) { | |
| 101 | _log .error(ex) ; | |
| 102 | } | |
| 103 | } | |
| 104 | re turn outbo undPropert y; | |
| 105 | } | |
| 106 | ||
| 107 | public Set getHe aders() { | |
| 108 | // throw new Unsupporte dOperation Exception( "Not suppo rted yet." ); | |
| 109 | re turn null; | |
| 110 | } | |
| 111 | ||
| 112 | public boolean h andleFault (SOAPMessa geContext context) { | |
| 113 | // throw new Unsupporte dOperation Exception( "Not suppo rted yet." ); | |
| 114 | re turn true; | |
| 115 | } | |
| 116 | ||
| 117 | public void clos e(MessageC ontext con text) { | |
| 118 | } | |
| 119 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.