2298. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/5/2018 9:05:54 PM Central 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.

2298.1 Files compared

# Location File Last Modified
1 MHEDP3_VAOS_VATS_SM_Sept2018.zip\VAR 4.5.2\var-resources-4.5.2.zip\ResourceIntTest\src\resinttest\java\com\agilex\healthcare\veteranappointment\clientapi JwtClient.java Wed Aug 15 03:28:53 2018 UTC
2 MHEDP3_VAOS_VATS_SM_Sept2018.zip\VAR 4.5.2\var-resources-4.5.2.zip\ResourceIntTest\src\resinttest\java\com\agilex\healthcare\veteranappointment\clientapi JwtClient.java Fri Oct 5 20:32:22 2018 UTC

2298.2 Comparison summary

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

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

2298.4 Active regular expressions

No regular expressions were active.

2298.5 Comparison detail

  1   package co m.agilex.h ealthcare. veteranapp ointment.c lientapi;
  2  
  3   import jav a.io.DataO utputStrea m;
  4   import jav a.io.IOExc eption;
  5   import jav a.net.URL;
  6   import jav a.net.Http URLConnect ion;
  7   import jav a.net.Cook ieManager;
  8   import jav a.net.Cook ieHandler;
  9   import jav a.util.Ite rator;
  10   import jav a.util.Lis t;
  11   import jav a.util.Map ;
  12   import jav a.util.Set ;
  13  
  14   public cla ss JwtClie nt {
  15       privat e static H ttpURLConn ection con n;
  16  
  17         private fi nal String  JWT_KEY_N AME = " EKL ";
  18         private fi nal String  HOST = "l ocalhost: PORT ";
  19       privat e final St ring LOGIN _URL = "ht tp://" + H OST + "/ss oeproxy/lo gin";
  20       privat e final St ring FAKE_ URL = "htt p://" + HO ST + "/any where";
  21       privat e final St ring USER_ NAME = "mo ckuser01";
  22       privat e final St ring PASSW ORD = "pas s";
  23       privat e final St ring LOGIN _PARAMS =  "username= " + USER_N AME +
  24                                               "&password =" + PASSW ORD;
  25  
  26       public  JwtClient () {
  27       }
  28  
  29       public  String ge tJwt() thr ows IOExce ption {
  30           Co okieHandle r.setDefau lt(new Coo kieManager ());
  31  
  32           do Login();
  33           cl oseUrlConn ection();
  34           do FakeReques t();
  35           St ring jwtVa lue = getJ wtValue();
  36           cl oseUrlConn ection();
  37  
  38           re turn jwtVa lue;
  39       }
  40  
  41       privat e void doL ogin() thr ows IOExce ption {
  42           UR L url = ne w URL(LOGI N_URL);
  43           co nn = (Http URLConnect ion) url.o penConnect ion();
  44           co nn.setUseC aches(fals e);
  45           co nn.setRequ estMethod( "POST");
  46           co nn.setRequ estPropert y("Host",  HOST);
  47           co nn.setRequ estPropert y("Connect ion", "kee p-alive");
  48           co nn.setRequ estPropert y("Referer ", LOGIN_U RL);
  49           co nn.setRequ estPropert y("Content -Type", "a pplication /x-www-for m-urlencod ed");
  50           co nn.setRequ estPropert y("Content -Length",  Integer.to String(LOG IN_PARAMS. length())) ;
  51           co nn.setDoOu tput(true) ;
  52  
  53           Da taOutputSt ream dataO utputStrea m = new Da taOutputSt ream(conn. getOutputS tream());
  54           da taOutputSt ream.write Bytes(LOGI N_PARAMS);
  55           da taOutputSt ream.flush ();
  56           da taOutputSt ream.close ();
  57  
  58           co nn.getResp onseCode() ;
  59       }
  60  
  61       privat e void doF akeRequest () throws  IOExceptio n {
  62           UR L url = ne w URL(FAKE _URL);
  63           co nn = (Http URLConnect ion) url.o penConnect ion();
  64           co nn.setRequ estMethod( "GET");
  65           co nn.setUseC aches(fals e);
  66           co nn.getResp onseCode() ;
  67       }
  68  
  69       privat e String g etJwtValue () {
  70           St ring jwtVa lue = null ;
  71  
  72           Ma p<String,  List<Strin g>> header s = conn.g etHeaderFi elds();
  73           Se t<String>  headerSet  = headers. keySet();
  74           It erator<Str ing> heade rIterator  = headerSe t.iterator ();
  75  
  76           wh ile (heade rIterator. hasNext()  && jwtValu e == null)  {
  77                String k ey = heade rIterator. next();
  78  
  79                if ("Set -Cookie".e qualsIgnor eCase(key) ) {
  80                    List <String> h eaderValue s = header s.get(key) ;
  81  
  82                    for  (String he aderValue  : headerVa lues) {
  83                         String[] v alues = he aderValue. split("=|; ");
  84  
  85                         if (values .length >  2 && value s[0].conta ins(JWT_KE Y_NAME)) {
  86                             jwtVal ue = value s[1];
  87                             break;
  88                         }
  89                    }
  90                }
  91           }
  92  
  93           re turn jwtVa lue;
  94       }
  95  
  96       privat e void clo seUrlConne ction() {
  97           if  (conn !=  null) {
  98                conn.dis connect();
  99                conn = n ull;
  100           }
  101       }
  102   }