221. EPMO Open Source Coordination Office Redaction File Detail Report

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

221.1 Files compared

# Location File Last Modified
1 MHV_2018.4.0.0.zip\2018.4.0.0\national portal\mhv_source\mhv_vital_signs\mhv-vital-signs-portal-portlet\src\main\java\gov\va\med\mhv\vitals\web\pgd JwtAuthResponseInterceptor.java Thu Aug 23 21:14:10 2018 UTC
2 MHV_2018.4.0.0.zip\2018.4.0.0\national portal\mhv_source\mhv_vital_signs\mhv-vital-signs-portal-portlet\src\main\java\gov\va\med\mhv\vitals\web\pgd JwtAuthResponseInterceptor.java Sun Sep 16 00:03:09 2018 UTC

221.2 Comparison summary

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

221.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

221.4 Active regular expressions

No regular expressions were active.

221.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.m hv.vitals. web.pgd;
  5  
  6   import jav a.io.IOExc eption;
  7   import jav a.util.Lis t;
  8   import jav a.util.Map ;
  9  
  10   import jav ax.servlet .http.Http Session;
  11  
  12   import com .liferay.p ortal.kern el.log.Log ;
  13   import com .liferay.p ortal.kern el.log.Log FactoryUti l;
  14   import com .liferay.p ortal.kern el.servlet .PortalSes sionThread Local;
  15  
  16   import ca. uhn.fhir.r est.client .api.IClie ntIntercep tor;
  17   import ca. uhn.fhir.r est.client .api.IHttp Request;
  18   import ca. uhn.fhir.r est.client .api.IHttp Response;
  19  
  20   /**
  21    * @author   DNS
  22    *
  23    * Interce ptor respo nsible for  capturing  the updat ed JWT aut henticatio n
  24    * token i n response  to a call  to a VAMF  secure we b service  endpoint.
  25    */
  26   public cla ss JwtAuth ResponseIn terceptor  implements  IClientIn terceptor  {
  27           
  28           pr ivate stat ic final L og LOG = L ogFactoryU til.getLog (JwtAuthRe sponseInte rceptor.cl ass);
  29           
  30           pr ivate stat ic final S tring VAMF _JWT_TOKEN _ATTR_NAME  = "MhvVit alsVamfAut henticated Jwt";
  31           
  32           pr ivate stat ic final S tring JWT_ RESPONSE_H EADER = "" ;
  33           
  34           /* *
  35            *  
  36            * /
  37           pu blic JwtAu thResponse Intercepto r() {
  38                    // T ODO Auto-g enerated c onstructor  stub
  39           }
  40  
  41           /*  (non-Java doc)
  42            *  @see ca.u hn.fhir.re st.client. api.IClien tIntercept or#interce ptRequest( ca.uhn.fhi r.rest.cli ent.api.IH ttpRequest )
  43            * /
  44           @O verride
  45           pu blic void  interceptR equest(IHt tpRequest  theRequest ) {
  46                    // N othing to  do here.
  47  
  48           }
  49  
  50           /*  (non-Java doc)
  51            *  @see ca.u hn.fhir.re st.client. api.IClien tIntercept or#interce ptResponse (ca.uhn.fh ir.rest.cl ient.api.I HttpRespon se)
  52            * /
  53           @O verride
  54           pu blic void  interceptR esponse(IH ttpRespons e theRespo nse) throw s IOExcept ion {
  55                    Http Session se ssion = nu ll;
  56                    
  57                    try  {
  58                             Map<St ring, List <String>>  allHeaders Map = theR esponse.ge tAllHeader s();
  59                             if(LOG .isDebugEn abled()) {
  60                                      for(Stri ng key : a llHeadersM ap.keySet( )) {
  61                                               StringBuff er sbHeade rValues =  new String Buffer();
  62                                               sbHeaderVa lues.appen d("[");
  63                                               for(String  val : all HeadersMap .get(key))  {
  64                                                       if (sbHeaderV alues.leng th() > 1)  {
  65                                                                sbHe aderValues .append(', ');
  66                                                       }
  67                                                       sb HeaderValu es.append( "\"").appe nd(val).ap pend("\"") ;
  68                                               }
  69                                               sbHeaderVa lues.appen d("]");
  70                                               LOG.debug( String.for mat("Heade r key: %s,  value: %s ", key, sb HeaderValu es.toStrin g()));
  71                                      }
  72                             }
  73                             
  74                             String  jwtAuthTo ken = allH eadersMap. get(JWT_RE SPONSE_HEA DER).get(0 );
  75                             if(jwt AuthToken  != null &&  jwtAuthTo ken.length () != 0) {
  76  
  77                                      if(LOG.i sDebugEnab led()) {
  78                                               LOG.debug( "Updating  VAMF JWT A uth Token. ");
  79                                      }
  80                                      
  81                                      session  = PortalSe ssionThrea dLocal.get HttpSessio n();
  82                                      
  83                                      if(sessi on != null ) {
  84                                               session.se tAttribute (VAMF_JWT_ TOKEN_ATTR _NAME, jwt AuthToken) ;
  85                                      } 
  86                                      else {
  87                                               LOG.error( "Session i s null. Un able to up date token .");
  88                                      }
  89                             }
  90                             
  91                    } ca tch (Throw able t) {
  92                             String  errorMess age = Stri ng.format( "An error  occurred w hile retri eving %s t oken from  the respon se headers .", JWT_RE SPONSE_HEA DER);
  93                             LOG.er ror(errorM essage);
  94                             throw  new IOExce ption(erro rMessage,  t);
  95                    }
  96  
  97           }
  98  
  99   }