321. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/7/2018 11:36:14 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.

321.1 Files compared

# Location File Last Modified
1 C:\SCRUB\MHED\MHED\VATS 2.3.0\var-utility-resources-2.3.0@ab955ab4732\VarUtilityResourceIntTest\src\resIntTest\java\gov\va\vamf\scheduling\varutility\clientapi JerseyFactory.java Mon Sep 17 15:51:54 2018 UTC
2 C:\MHED-scrubbed\MHED\MHED\VATS 2.3.0\var-utility-resources-2.3.0@ab955ab4732\VarUtilityResourceIntTest\src\resIntTest\java\gov\va\vamf\scheduling\varutility\clientapi JerseyFactory.java Fri Dec 7 13:26:36 2018 UTC

321.2 Comparison summary

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

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

321.4 Active regular expressions

No regular expressions were active.

321.5 Comparison detail

  1   package go v.va.vamf. scheduling .varutilit y.clientap i;
  2  
  3  
  4   import com .fasterxml .jackson.d atabind.De serializat ionFeature ;
  5   import com .fasterxml .jackson.d atabind.Ob jectMapper ;
  6   import com .fasterxml .jackson.d atabind.Se rializatio nFeature;
  7   import com .fasterxml .jackson.j axrs.json. JacksonJax bJsonProvi der;
  8   import gov .va.vamf.s cheduling. varutility .testutili ty.Integra tionTestCo nfiguratio n;
  9   import org .glassfish .jersey.cl ient.authe ntication. HttpAuthen ticationFe ature;
  10   import org .glassfish .jersey.cl ient.oauth 2.OAuth2Cl ientSuppor t;
  11   import org .glassfish .jersey.ja ckson.Jack sonFeature ;
  12  
  13   import jav ax.ws.rs.c lient.Clie nt;
  14   import jav ax.ws.rs.c lient.Clie ntBuilder;
  15   import jav ax.ws.rs.c ore.Featur e;
  16  
  17  
  18   public cla ss JerseyF actory {
  19           pr ivate stat ic final S tring DIGE ST_AUTHENT ICATION =  "digest";
  20           pr ivate stat ic final S tring BASI C_AUTHENTI CATION = " basic";
  21           pr ivate stat ic final S tring OAUT H_AUTHENTI CATION = " oauth";
  22           pr ivate stat ic final o rg.apache. commons.lo gging.Log  logger = o rg.apache. commons.lo gging.LogF actory.get Log(Jersey Factory.cl ass);
  23  
  24           pu blic stati c Client c reateJerse yClient(Au thenticati onInfo aut henticatio nInfo) {
  25                    Clie nt jerseyc lient = Cl ientBuilde r.newClien t();
  26                    logg er.debug(" creating j ersey clie nt");
  27  
  28                    if ( authentica tionInfo ! = null) {
  29                             Featur e authFeat ure = null ;
  30                              String  V s ID          
uthenticat ionInfo.ge tUsername( );
  31                              String  V s ID          
uthenticat ionInfo.ge tPassword( );
  32                             String  facilityN ame = auth entication Info.getFa cilityName ();
  33                             String  facilityC ode = auth entication Info.getFa cilityCode ();
  34  
  35                             if (au thenticati onInfo.get Authtype() .toLowerCa se().conte ntEquals(B ASIC_AUTHE NTICATION) ) {
  36                                      logger.d ebug(Strin g.format(" creating b asic auth  filter [%s ][%s]", us ername, pa ssword));
  37                                      authFeat ure = Http Authentica tionFeatur e.basic(us ername, pa ssword);
  38                             } else  if (authe nticationI nfo.getAut htype().to LowerCase( ).contentE quals(DIGE ST_AUTHENT ICATION))  {
  39                                      logger.d ebug(Strin g.format(" creating d igest auth  filter [% s][%s]", u sername, p assword));
  40                                      authFeat ure = Http Authentica tionFeatur e.digest(u sername, p assword);
  41                             } else  if (authe nticationI nfo.getAut htype().to LowerCase( ).contentE quals(OAUT H_AUTHENTI CATION)) {
  42                                      logger.d ebug(Strin g.format(" creating d igest auth  filter [% s][%s]", u sername, p assword));
  43                                      String a ccessToken  = retriev eOauthToke n(username , password , facility Name, faci lityCode);
  44                                      authFeat ure = OAut h2ClientSu pport.feat ure(access Token);
  45                             }
  46  
  47                             if (au thFeature  == null) {
  48                                      throw ne w RuntimeE xception(" Invalid au thenticati on type "  + authenti cationInfo .getAuthty pe());
  49                             }
  50                             Jackso nJaxbJsonP rovider pr ovider = n ew Jackson JaxbJsonPr ovider();
  51                             Object Mapper map per = new  ObjectMapp er();
  52                             mapper .configure (Deseriali zationFeat ure.FAIL_O N_UNKNOWN_ PROPERTIES , false);
  53                             mapper .configure (Deseriali zationFeat ure.ACCEPT _SINGLE_VA LUE_AS_ARR AY, true);
  54                             mapper .configure (Deseriali zationFeat ure.ADJUST _DATES_TO_ CONTEXT_TI ME_ZONE, f alse);
  55                             mapper .configure (Serializa tionFeatur e.WRITE_DA TES_AS_TIM ESTAMPS, f alse);
  56                             provid er.setMapp er(mapper) ;
  57                             jersey client.reg ister(prov ider);
  58                             jersey client.reg ister(auth Feature);
  59                             jersey client.reg ister(Jack sonFeature .class);
  60  
  61                    }
  62                    retu rn jerseyc lient;
  63           }
  64  
  65           pr ivate stat ic String  retrieveOa uthToken(S tring user name, Stri ng passwor d, String  facilityNa me, String  facilityC ode) {
  66                    Auth entication Info authe nticationI nfo = cons tructAuthI nfo(userna me, passwo rd, facili tyName, fa cilityCode );
  67                    Oaut hClient oa uthClient  = new Oaut hClient();
  68                    Stri ng accessT oken;
  69                    try  {
  70                             access Token = oa uthClient. authentica te(authent icationInf o, null);
  71                    } ca tch (Runti meExceptio n e) {
  72                             throw  e;
  73                    } ca tch (Excep tion e) {
  74                             throw  new Runtim eException (e);
  75                    }
  76                    retu rn accessT oken;
  77           }
  78  
  79           pr ivate stat ic Authent icationInf o construc tAuthInfo( String use rname, Str ing passwo rd, String  facilityN ame, Strin g facility Code) {
  80                    Auth entication Info authI nfo = new  Authentica tionInfo() ;
  81                    auth Info.setUs ername(use rname);
  82                    auth Info.setPa ssword(pas sword);
  83                    auth Info.setFa cilityName (facilityN ame);
  84                    auth Info.setFa cilityCode (facilityC ode);
  85                    auth Info.setCl ientId("Mo bileBlueBu tton");
  86                    auth Info.setCl ientSecret ("MBBWEB") ;
  87                    auth Info.setEx pectAuthen ticationRe quired(tru e);
  88                    auth Info.setAu thorizeUrl (Integrati onTestConf iguration. getMHPAuth orizeURI() );
  89                    auth Info.setTo kenUrl(Int egrationTe stConfigur ation.getM HPTokenURI ());
  90                    retu rn authInf o;
  91           }
  92  
  93   }