306. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:46 PM 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.

306.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingVistaRealm\main\src\java\gov\va\med\imaging\tomcat\vistarealm MockVistaRealm.java Mon Dec 4 21:35:10 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingVistaRealm\main\src\java\gov\va\med\imaging\tomcat\vistarealm MockVistaRealm.java Mon Dec 4 22:03:43 2017 UTC

306.2 Comparison summary

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

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

306.4 Active regular expressions

No regular expressions were active.

306.5 Comparison detail

  1   package go v.va.med.i maging.tom cat.vistar ealm;
  2  
  3   import jav a.beans.XM LDecoder;
  4   import jav a.beans.XM LEncoder;
  5   import jav a.io.FileN otFoundExc eption;
  6   import jav a.io.FileO utputStrea m;
  7   import jav a.io.Input Stream;
  8   import jav a.security .Principal ;
  9   import jav a.util.Arr ayList;
  10   import jav a.util.Lis t;
  11  
  12   import org .apache.lo gging.log4 j.LogManag er;
  13   import org .apache.lo gging.log4 j.Logger;
  14  
  15   /**
  16    * This cl ass provid es a Realm  that acts  like the  VistaREalm  except th at all of  its
  17    * authent ication is  done agai nst a set  of defined  (hard-cod ed) users.
  18    * 
  19    * @author         
BECKEC
  20    *
  21    */
  22   public cla ss MockVis taRealm 
  23   extends Vi staAccessV erifyRealm
  24   {
  25           pr ivate Logg er logger  = LogManag er.getLogg er(this.ge tClass());
  26           pu blic stati c final St ring usern ameFilenam e = "MockV istaRealmU sers.xml";
  27           pr ivate List <VistaReal mPrincipal > userList  = new Arr ayList<Vis taRealmPri ncipal>();
  28           
  29           pu blic MockV istaRealm(
  30           th rows Excep tion
  31           {
  32                    // t urn off Pr incipal ca ching
  33                    setU singPrinci palCache(f alse);
  34                    
  35                    try
  36                    {
  37                             loadUs erList();
  38                    } 
  39                    catc h (FileNot FoundExcep tion e)
  40                    {
  41                             e.prin tStackTrac e();
  42                             throw  new java.l ang.Except ion("Unabl e to read  configurat ion file") ;
  43                    }
  44           }
  45  
  46           pr ivate void  loadUserL ist() 
  47           th rows FileN otFoundExc eption
  48           {
  49                    Inpu tStream in Stream = g etClass(). getClassLo ader().get ResourceAs Stream(use rnameFilen ame);
  50                    XMLD ecoder dec oder = new  XMLDecode r(inStream );
  51                    
  52                    try
  53                    {
  54                             while( true)              //  will esca pe on an A rrayIndexO utOfBounds Exception
  55                             {
  56                                      MockVist aRealmPrin cipalDO pr incipalDO  = (MockVis taRealmPri ncipalDO)d ecoder.rea dObject();
  57                                      VistaRea lmPrincipa l principa l = create VistaRealm Principal( principalD O);
  58                                      logger.i nfo("MockV istaRealm  adding use r '" + pri ncipal.get AccessCode () + "'" ) ;
  59                                      userList .add(princ ipal);
  60                             }
  61                    } 
  62                    catc h (ArrayIn dexOutOfBo undsExcept ion e)
  63                    {
  64                             // we' re done re ading
  65                    }
  66                    deco der.close( );
  67                    
  68           }
  69  
  70           @O verride
  71           pu blic Princ ipal authe nticate(St ring usern ame, Strin g password )
  72           {
  73                    logg er.info("M ockVistaRe alm - auth enticate ( " + userna me + ", <p assword no t shown>)" );
  74  
  75                    if(u sername ==  null)
  76                             return  null;
  77                    
  78                    for( VistaRealm Principal  principal:  userList)
  79                             if(pri ncipal.get AccessCode ().equals( username)  && princip al.getVeri fyCode().e quals(pass word))
  80                             {
  81                                      logger.i nfo("MockV istaRealm  - authenti cate (" +  username +  ", <passw ord not sh own>) auth enticated  !");
  82                                      return p rincipal;
  83                             }
  84                    
  85                    logg er.info("M ockVistaRe alm - auth enticate ( " + userna me + ", <p assword no t shown>)  NOT authen ticated !" );
  86                    retu rn null;
  87           }
  88  
  89           /* *
  90            *  Just a li ttle utili ty to writ e out the  users file .
  91            *  
  92            *  @param ar gv
  93            *  @throws F ileNotFoun dException
  94            * /
  95           pu blic stati c void mai n(String[]  argv) 
  96           th rows FileN otFoundExc eption
  97           {
  98                    File OutputStre am outStre am = new F ileOutputS tream(user nameFilena me);
  99                    XMLE ncoder enc oder = new  XMLEncode r(outStrea m);
  100                    
  101                    enco der.writeO bject(new  MockVistaR ealmPrinci palDO("Vis taRealm",  "boating1" , "boating 1.", "6553 21", "Alex  DeLarge",  "111-22-3 333", "660 ", "SLC",  new String []{VistaRe almRoles.V istaUserRo le.getRole Name()}));
  102                    enco der.writeO bject(new  MockVistaR ealmPrinci palDO("Vis taRealm",  "doduser",  "dodpassw ord", "655 321", "DOD  User", "2 22-33-4444 ", "660",  "SLC", new  String[]{ VistaRealm Roles.Vist aUserRole. getRoleNam e()}));
  103                    enco der.writeO bject(new  MockVistaR ealmPrinci palDO("Vis taRealm",  "alexdelar ge", "6553 21", null,  null, nul l, null, n ull, new S tring[]{Vi staRealmRo les.Clinic alDisplayU ser.getRol eName()})) ;
  104                    enco der.writeO bject(new  MockVistaR ealmPrinci palDO("Vis taRealm",  "vixs", "v ixs", null , null, nu ll, null,  null, new  String[]{V istaRealmR oles.PeerV ixsRole.ge tRoleName( )}));
  105                    enco der.writeO bject(new  MockVistaR ealmPrinci palDO("Vis taRealm",  "admin", " raptor", n ull, null,  null, nul l, null, n ew String[ ]{VistaRea lmRoles.Ad ministrato rRole.getR oleName()} ));
  106  
  107                    enco der.close( );
  108           }
  109           
  110           pu blic stati c VistaRea lmPrincipa l createVi staRealmPr incipal(Mo ckVistaRea lmPrincipa lDO princi palDO)
  111           {
  112                    List <String> r oleList =  new ArrayL ist<String >();
  113                    
  114                    for( String rol e: princip alDO.getRo les())
  115                             roleLi st.add(rol e);
  116                    
  117                    Vist aRealmPrin cipal prin cipal = ne w VistaRea lmPrincipa l(
  118                             princi palDO.getR ealm(), fa lse, Vista RealmPrinc ipal.Authe nticationC redentials Type.Passw ord, 
  119                             princi palDO.getA ccess(), p rincipalDO .getVerify (), 
  120                             princi palDO.getD uz(), prin cipalDO.ge tFullname( ), princip alDO.getSs n(), 
  121                             princi palDO.getS iteNumber( ), princip alDO.getSi tename(), 
  122                             roleLi st, null);
  123  
  124                    retu rn princip al;
  125           }
  126           
  127   }
  128