143. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/15/2018 10:48:15 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.

143.1 Files compared

# Location File Last Modified
1 MHV_2018.4.0.0.zip\2018.4.0.0\national portal\mhv_source\mhv_liferay\mhv-urlrewrite-ext\src\main\java\gov\va\med\mhv\urlrewrite\rules VeteransBenefitHandbookRewriteMatch.java Thu Aug 23 21:32:38 2018 UTC
2 MHV_2018.4.0.0.zip\2018.4.0.0\national portal\mhv_source\mhv_liferay\mhv-urlrewrite-ext\src\main\java\gov\va\med\mhv\urlrewrite\rules VeteransBenefitHandbookRewriteMatch.java Sat Sep 15 21:55:41 2018 UTC

143.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 318
Changed 1 2
Inserted 0 0
Removed 0 0

143.3 Comparison options

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

143.4 Active regular expressions

No regular expressions were active.

143.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.m hv.urlrewr ite.rules;
  5  
  6   import jav a.io.IOExc eption;
  7   import jav a.util.Col lections;
  8   import jav a.util.Enu meration;
  9   import jav a.util.Has hMap;
  10   import jav a.util.Lis t;
  11   import jav a.util.Map ;
  12  
  13   import jav ax.servlet .ServletEx ception;
  14   import jav ax.servlet .http.Http ServletReq uest;
  15   import jav ax.servlet .http.Http ServletReq uestWrappe r;
  16   import jav ax.servlet .http.Http ServletRes ponse;
  17   import jav ax.servlet .http.Http Session;
  18  
  19   import org .tuckey.we b.filters. urlrewrite .RequestPr oxy;
  20   import org .tuckey.we b.filters. urlrewrite .extend.Re writeMatch ;
  21  
  22   /**
  23    * @author   DNS
  24    *
  25    */
  26   public cla ss Veteran sBenefitHa ndbookRewr iteMatch e xtends Rew riteMatch  {
  27           
  28           pr ivate stat ic final S tring ATTR _EAUTH_LAS TNAME                            = "LIFERAY _SHARED_va _eauth_las tname";
  29           pr ivate stat ic final S tring ATTR _EAUTH_FIR STNAME                           = "LIFERAY _SHARED_va _eauth_fir stname";
  30           pr ivate stat ic final S tring ATTR _EAUTH_SUF FIX                              = "LIFERAY _SHARED_va _eauth_suf fix";
  31           pr ivate stat ic final S tring ATTR _EAUTH_GEN DER                              = "LIFERAY _SHARED_va _eauth_gen der";
  32           pr ivate stat ic final S tring ATTR _EAUTH_ICN                                          =  "LIFERAY_S HARED_va_e auth_icn";
  33           pr ivate stat ic final S tring ATTR _EAUTH_TAR GET                              = "LIFERAY _SHARED_vh b_target_l ocation";
  34  
  35           pr ivate stat ic final S tring HEAD ER_EAUTH_L ASTNAME                          = "va_eaut h_lastname ";
  36           pr ivate stat ic final S tring HEAD ER_EAUTH_F IRSTNAME                         = "va_eaut h_firstnam e";
  37           pr ivate stat ic final S tring HEAD ER_EAUTH_S UFFIX                            = "va_eaut h_suffix";
  38           pr ivate stat ic final S tring HEAD ER_EAUTH_G ENDER                            = "va_eaut h_gender";
  39           pr ivate stat ic final S tring HEAD ER_EAUTH_I CN                               = "va_eaut h_icn";
  40           
  41           pr ivate Stri ng request edURI;
  42           
  43           pu blic Veter ansBenefit HandbookRe writeMatch (String re questedURI ) {
  44                    this .requested URI = requ estedURI;
  45           }
  46  
  47           pu blic boole an execute (HttpServl etRequest  request, H ttpServlet Response r esponse)
  48                             throws  ServletEx ception, I OException  {
  49                    
  50                    Obje ct target  = request. getSession ().getAttr ibute(ATTR _EAUTH_TAR GET);
  51                    if(t arget == n ull || "". equals(tar get)) {
  52                             throw  new Servle tException ("Session  lacking VH B Taret Lo cation URI .");
  53                    }
  54                    
  55                    Stri ng targetU ri = ((Str ing)target ) + this.r equestedUR I;
  56  
  57                    // a dd the req uired head ers
  58                    requ est = addE authHeader sFromSessi on(request );
  59  
  60                    // U se the req uest proxy  to proxy  the reques t to the b ackend sys tem
  61                    Requ estProxy.e xecute(tar getUri, re quest, res ponse);
  62  
  63                    retu rn true;
  64           }
  65  
  66  
  67           pr ivate Http ServletReq uest addEa uthHeaders FromSessio n(HttpServ letRequest  request)  {
  68                    
  69                    Http Session se ssion = re quest.getS ession();
  70                    
  71                    // v alidates t hat the re quired att ributes ar e in the s ession; th rows an
  72                    // I llegalArgu mentExcept ion with a  descripti ve message  if they a re not.
  73                    vali dateRequir edAttribut es(session );
  74                    
  75                    // c reate the  request wr apper that  allows th e addition  of header s
  76                    Head erMapReque stWrapper  headerMapR equest = n ew HeaderM apRequestW rapper(req uest);
  77                    
  78                    // a dd the req uired head ers
  79                    head erMapReque st.addHead er(HEADER_ EAUTH_LAST NAME, (Str ing)sessio n.getAttri bute(ATTR_ EAUTH_LAST NAME));
  80                    head erMapReque st.addHead er(HEADER_ EAUTH_FIRS TNAME, (St ring)sessi on.getAttr ibute(ATTR _EAUTH_FIR STNAME));
  81                    head erMapReque st.addHead er(HEADER_ EAUTH_SUFF IX, (Strin g)session. getAttribu te(ATTR_EA UTH_SUFFIX ));
  82                    head erMapReque st.addHead er(HEADER_ EAUTH_GEND ER, (Strin g)session. getAttribu te(ATTR_EA UTH_GENDER ));
  83                    head erMapReque st.addHead er(HEADER_ EAUTH_ICN,  (String)s ession.get Attribute( ATTR_EAUTH _ICN));
  84                    
  85                    retu rn headerM apRequest;
  86           }
  87           
  88           /*
  89            *  Validates  that non  of the req uired para meters are  null or e mpty.
  90            * /
  91           pr ivate void  validateR equiredAtt ributes(Ht tpSession  session) {
  92                    Bool ean hasLas tName = se ssion.getA ttribute(A TTR_EAUTH_ LASTNAME)  != null &&  !"".equal s(session. getAttribu te(ATTR_EA UTH_LASTNA ME));
  93                    Bool ean hasFir stName = s ession.get Attribute( ATTR_EAUTH _FIRSTNAME ) != null  && !"".equ als(sessio n.getAttri bute(ATTR_ EAUTH_FIRS TNAME));
  94                    Bool ean hasGen der = sess ion.getAtt ribute(ATT R_EAUTH_GE NDER) != n ull && !"" .equals(se ssion.getA ttribute(A TTR_EAUTH_ GENDER));
  95                    Bool ean hasIcn  = session .getAttrib ute(ATTR_E AUTH_ICN)  != null &&  !"".equal s(session. getAttribu te(ATTR_EA UTH_ICN));
  96                    
  97                    Bool ean hasReq uired = ha sLastName  && hasFirs tName && h asGender & & hasIcn;
  98                    if(! hasRequire d) {
  99                             String  errorMess age = Stri ng.format( "Required  parameters  not found . First Na me: %s, La st Name; % s, Gender:  %s, ICN:  %s", 
  100                                               session.ge tAttribute (ATTR_EAUT H_FIRSTNAM E), sessio n.getAttri bute(ATTR_ EAUTH_LAST NAME),
  101                                               session.ge tAttribute (ATTR_EAUT H_GENDER),  session.g etAttribut e(ATTR_EAU TH_ICN));
  102                             throw  new Illega lArgumentE xception(e rrorMessag e);
  103                    }
  104           }
  105           
  106           pr ivate clas s HeaderMa pRequestWr apper exte nds HttpSe rvletReque stWrapper  {
  107                    /**
  108                     * c onstruct a  wrapper f or this re quest
  109                     * 
  110                     * @ param requ est
  111                     */
  112                    publ ic HeaderM apRequestW rapper(Htt pServletRe quest requ est) {
  113                             super( request);
  114                    }
  115  
  116                    priv ate Map<St ring, Stri ng> header Map = new  HashMap<St ring, Stri ng>();
  117  
  118                    /**
  119                     * a dd a heade r with giv en name an d value
  120                     * 
  121                     * @ param name
  122                     * @ param valu e
  123                     */
  124                    publ ic void ad dHeader(St ring name,  String va lue) {
  125                             header Map.put(na me, value) ;
  126                    }
  127  
  128                    @Ove rride
  129                    publ ic String  getHeader( String nam e) {
  130                             String  headerVal ue = super .getHeader (name);
  131                             if (he aderMap.co ntainsKey( name)) {
  132                                      headerVa lue = head erMap.get( name);
  133                             }
  134                             return  headerVal ue;
  135                    }
  136  
  137                    /**
  138                     * g et the Hea der names
  139                     */
  140                    @Ove rride
  141                    publ ic Enumera tion<Strin g> getHead erNames()  {
  142                             List<S tring> nam es = Colle ctions.lis t(super.ge tHeaderNam es());
  143                             for (S tring name  : headerM ap.keySet( )) {
  144                                      names.ad d(name);
  145                             }
  146                             return  Collectio ns.enumera tion(names );
  147                    }
  148  
  149                    @Ove rride
  150                    publ ic Enumera tion<Strin g> getHead ers(String  name) {
  151                             List<S tring> val ues = Coll ections.li st(super.g etHeaders( name));
  152                             if (he aderMap.co ntainsKey( name)) {
  153                                      values.a dd(headerM ap.get(nam e));
  154                             }
  155                             return  Collectio ns.enumera tion(value s);
  156                    }
  157  
  158           }
  159  
  160   }