Produced by Araxis Merge on 6/9/2017 3:50:36 PM Eastern Daylight 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 | Fri Jun 9 19:50:36 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-mock\src\main\java\gov\va\nvap\mock\endpoint\permission\pdp | MockPDPServiceEndpoint.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 106 |
| 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.va.nvap. mock.endpo int.permis sion.pdp; | |||||
| 2 | ||||||
| 3 | import jav a.util.Lis t; | |||||
| 4 | ||||||
| 5 | import gov .va.nvap.s ervice.per mission.pd p.PDPInter face; | |||||
| 6 | import gov .va.nvap.s vc.consent eval.commo n.XACMLCon textConsta nts; | |||||
| 7 | import sta tic gov.va .nvap.svc. consenteva l.common.X ACMLContex tConstants .RESOURCE_ CONF_CODE_ ATTR_ID; | |||||
| 8 | import sta tic gov.va .nvap.svc. consenteva l.common.X ACMLContex tConstants .STRING_AT TR_DATA_TY PE; | |||||
| 9 | import sta tic gov.va .nvap.svc. consenteva l.common.X ACMLContex tConstants .XACML_REQ UEST_SUBJE CT_PURPOSE _FOR_USE_A TTR_ID; | |||||
| 10 | import gov .va.nvap.s vc.consent eval.commo n.XACMLCon textUtil; | |||||
| 11 | import gov .va.nvap.s vc.consent eval.commo n.XACMLReq uestParser ; | |||||
| 12 | import oas is.names.t c.xacml._2 _0.context .schema.os .DecisionT ype; | |||||
| 13 | import oas is.names.t c.xacml._2 _0.context .schema.os .RequestTy pe; | |||||
| 14 | import oas is.names.t c.xacml._2 _0.context .schema.os .ResponseT ype; | |||||
| 15 | import oas is.names.t c.xacml._2 _0.context .schema.os .ResultTyp e; | |||||
| 16 | import oas is.names.t c.xacml._2 _0.policy. schema.os. AttributeA ssignmentT ype; | |||||
| 17 | import oas is.names.t c.xacml._2 _0.policy. schema.os. EffectType ; | |||||
| 18 | import oas is.names.t c.xacml._2 _0.policy. schema.os. Obligation Type; | |||||
| 19 | import oas is.names.t c.xacml._2 _0.policy. schema.os. Obligation sType; | |||||
| 20 | ||||||
| 21 | /** | |||||
| 22 | * | |||||
| 23 | * @author cbarber | |||||
| 24 | */ | |||||
| 25 | public cla ss MockPDP ServiceEnd point impl ements PDP Interface | |||||
| 26 | { | |||||
| 27 | public static fi nal String SAMPLE_OB LIGATION_L ABEL_POU = "urn:gov. va.nhin.ob ligation.l abel-pou"; | |||||
| 28 | public static fi nal String SAMPLE_PO U_VALUE_TR EATMENT = "TREATMENT "; | |||||
| 29 | ||||||
| 30 | @Overr ide | |||||
| 31 | public ResponseT ype checkP olicy(Requ estType bo dy) | |||||
| 32 | { | |||||
| 33 | /* * | |||||
| 34 | * If not do cQuery or DocRetriev e return t rue | |||||
| 35 | * / | |||||
| 36 | if (!XACMLRe questParse r.isDocQue ry(body) & & !XACMLRe questParse r.isDocRet rieve(body )) | |||||
| 37 | { | |||||
| 38 | retu rn generat eResponse( true); | |||||
| 39 | } | |||||
| 40 | ||||||
| 41 | /* * | |||||
| 42 | * If the co nfidential ity code i s "NORMAL" generateR esponse(tr ue) else f alse | |||||
| 43 | * / | |||||
| 44 | Li st<String> confident ialityCode List = XAC MLContextU til.getRes ourceAttri buteValues ( | |||||
| 45 | body, RESOURCE_C ONF_CODE_A TTR_ID); | |||||
| 46 | ||||||
| 47 | if ( (confident ialityCode List != nu ll) && (co nfidential ityCodeLis t.size() > 0)) | |||||
| 48 | { | |||||
| 49 | String c onfCode = confidenti alityCodeL ist.get(0) ; | |||||
| 50 | if(XACML ContextCon stants.RES OURCE_CONF _CODE_VAL_ NORMAL.equ als(confCo de)) | |||||
| 51 | { | |||||
| 52 | retu rn generat eResponse( true); | |||||
| 53 | } | |||||
| 54 | } | |||||
| 55 | ||||||
| 56 | ||||||
| 57 | /* * | |||||
| 58 | * Determine the Opt-I n resource value and call gene rateRespon se with bo olean valu e | |||||
| 59 | * / | |||||
| 60 | bo olean isPa tientOpted In = false ; | |||||
| 61 | Li st<String> optInList = XACMLCo ntextUtil. getResourc eAttribute Values( | |||||
| 62 | body, XACMLConte xtConstant s.RESOURCE _OPTIN_ATT R_ID); | |||||
| 63 | ||||||
| 64 | if ( (optInList != null) && (optInL ist.size() > 0)) | |||||
| 65 | { | |||||
| 66 | isPati entOptedIn = XACMLCo ntextConst ants.RESOU RCE_OPTIN_ YES_VALUE | |||||
| 67 | .equals(op tInList.ge t(0)); | |||||
| 68 | } | |||||
| 69 | ||||||
| 70 | re turn gener ateRespons e(isPatien tOptedIn); | |||||
| 71 | } | |||||
| 72 | ||||||
| 73 | ||||||
| 74 | // TOD O first pa rt copied from Polic yEvaluatio nServiceIm pl ... see about fac toring | |||||
| 75 | // out into comm on library . | |||||
| 76 | pu blic stati c Response Type gener ateRespons e(final bo olean auth orized) | |||||
| 77 | { | |||||
| 78 | fina l Response Type respo nse = new ResponseTy pe(); | |||||
| 79 | fina l List<Res ultType> r esults = r esponse.ge tResult(); | |||||
| 80 | fina l ResultTy pe result = new Resu ltType(); | |||||
| 81 | resu lt.setDeci sion(autho rized ? De cisionType .PERMIT : DecisionTy pe.DENY); | |||||
| 82 | ||||||
| 83 | // *** | |||||
| 84 | // Add an ob ligation t o test tha t it is fo rwarded in response from VAP | |||||
| 85 | // *** | |||||
| 86 | if (authorize d) | |||||
| 87 | { | |||||
| 88 | // the a ctual obli gation | |||||
| 89 | Obligati onType sam pleOblig = new Oblig ationType( ); | |||||
| 90 | sampleOb lig.setObl igationId( SAMPLE_OBL IGATION_LA BEL_POU); | |||||
| 91 | sampleOb lig.setFul fillOn(Eff ectType.PE RMIT); | |||||
| 92 | Attribut eAssignmen tType obli gAttr = ne w Attribut eAssignmen tType(); | |||||
| 93 | obligAtt r.setAttri buteId(XAC ML_REQUEST _SUBJECT_P URPOSE_FOR _USE_ATTR_ ID); | |||||
| 94 | obligAtt r.setDataT ype(STRING _ATTR_DATA _TYPE); | |||||
| 95 | obligAtt r.getConte nt().add(S AMPLE_POU_ VALUE_TREA TMENT); | |||||
| 96 | sampleOb lig.getAtt ributeAssi gnment().a dd(obligAt tr); | |||||
| 97 | ||||||
| 98 | // wire it into th e result | |||||
| 99 | Obligati onsType ob ligsParent = new Obl igationsTy pe(); | |||||
| 100 | obligsPa rent.getOb ligation() .add(sampl eOblig); | |||||
| 101 | result.s etObligati ons(obligs Parent); | |||||
| 102 | } | |||||
| 103 | resu lts.add(re sult); | |||||
| 104 | re turn respo nse; | |||||
| 105 | } | |||||
| 106 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.