82. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/10/2017 1:01:45 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.

82.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\IV-ehmp_cif\ImagingVistaRealm\main\src\java\gov\va\med\imaging\tomcat\vistarealm SecurityConstraintAuthorizationList.java Thu Jun 29 17:23:03 2017 UTC
2 C:\AraxisMergeCompare\Pri_re\IV-ehmp_cif\ImagingVistaRealm\main\src\java\gov\va\med\imaging\tomcat\vistarealm SecurityConstraintAuthorizationList.java Thu Jul 6 15:03:43 2017 UTC

82.2 Comparison summary

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

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

82.4 Active regular expressions

No regular expressions were active.

82.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i maging.tom cat.vistar ealm;
  5  
  6   import jav a.util.Arr ayList;
  7   import jav a.util.Lis t;
  8  
  9   import org .apache.to mcat.util. descriptor .web.Secur ityConstra int;
  10   import org .apache.lo g4j.Logger ;
  11  
  12   /**
  13    * @author         
BECKEC
  14    *
  15    * This cl ass implem ents part  of the req uirements  of Section  12.8.1 of  the servl et spec v  2.4
  16    * 
  17    * Section  12.8.1:
  18    * "When a  url-patte rn and htt p-method p air occurs  in multip le securit y constrai nts, the c onstraints  (on the p attern and  method) a re defined  by combin ing the in dividual
  19    * constra ints. The  rules for  combining  constraint s in which  the same  pattern an d method o ccur are a s follows:
  20    * 
  21    * The com bination o f authoriz ation cons traints th at name ro les or tha t imply ro les via th e name “*”  shall yie ld the uni on of the  role names  in the in dividual
  22    * constra ints as pe rmitted ro les. 
  23    * A secur ity constr aint that  does not c ontain an  authorizat ion constr aint shall  combine w ith author ization co nstraints  that name  or imply r oles to 
  24    * allow u nauthentic ated acces s. 
  25    * The spe cial case  of an auth orization  constraint  that name s no roles  shall com bine with  any other  constraint s to overr ide their  affects an d cause 
  26    * access  to be prec luded.
  27    */
  28   public cla ss Securit yConstrain tAuthoriza tionList<T  extends S ecurityCon straint> 
  29   extends Ar rayList<T>
  30   {
  31           pr ivate stat ic final l ong serial VersionUID  = -462267 7800189536 16L;
  32           pr ivate Logg er logger  = Logger.g etLogger(t his.getCla ss());
  33  
  34           pu blic Secur ityConstra intAuthori zationList (T[] secur ityConstra ints)
  35           {
  36                    supe r();
  37                    
  38                    for(  T securit yConstrain t: securit yConstrain ts )
  39                             add(se curityCons traint);
  40           }
  41  
  42           /* *
  43            *  
  44            *  @return
  45            * /
  46           pu blic boole an isDenyA llAccess()
  47           {
  48                    for(  T securit yConstrain t: this )
  49                             // if  there is a n auth-con straint an d it has n o roles th en deny al l access
  50                             if( se curityCons traint.get AuthConstr aint() &&  securityCo nstraint.f indAuthRol es() != nu ll && secu rityConstr aint.findA uthRoles() .length ==  0 )
  51                             {
  52                                      logger.d ebug("isDe nyAllAcces s returns  true, key  security c onstraint  is '" + se curityCons traint.get DisplayNam e() + "'") ;
  53                                      return t rue;
  54                             }
  55                    logg er.debug(" isDenyAllA ccess retu rns false" );
  56                    retu rn false;
  57           }
  58  
  59           pu blic boole an isAllow Unauthenti catedAcces s()
  60           {
  61                    bool ean allowU nauthentic atedAccess  = false;
  62                    for(  T securit yConstrain t: this )
  63                    {
  64                             // if  there is a n auth-con straint an d it has n o roles th en deny al l access
  65                             if( se curityCons traint.get AuthConstr aint() &&  securityCo nstraint.f indAuthRol es() != nu ll && secu rityConstr aint.findA uthRoles() .length ==  0 )
  66                             {
  67                                      logger.d ebug("isAl lowUnauthe nticatedAc cess retur ns false,  key securi ty constra int is '"  + security Constraint .getDispla yName() +  "'");
  68                                      return f alse;
  69                             }
  70                             
  71                             if( se curityCons traint.get AuthConstr aint() &&  securityCo nstraint.f indAuthRol e("*") )
  72                                      allowUna uthenticat edAccess =  true;
  73                    }
  74                    logg er.debug(" isAllowUna uthenticat edAccess r eturns " +  allowUnau thenticate dAccess);
  75                    retu rn allowUn authentica tedAccess;
  76           }
  77  
  78           pu blic boole an isAnyRo leAllowedA ccess(List <String> r oles)
  79           {
  80                    Stri ng[] roleA rray = new  String[ro les.size() ];
  81                    retu rn isAnyRo leAllowedA ccess(role s.toArray( roleArray) );
  82           }
  83           
  84           pu blic boole an isAnyRo leAllowedA ccess(Stri ng[] roles )
  85           {
  86                    bool ean allowA ccess = fa lse;
  87                    for(  T securit yConstrain t: this )
  88                    {
  89                             // if  there is a n auth-con straint an d it has n o roles th en deny al l access
  90                             if( se curityCons traint.get AuthConstr aint() &&  securityCo nstraint.f indAuthRol es() != nu ll && secu rityConstr aint.findA uthRoles() .length ==  0 )
  91                             {
  92                                      logger.d ebug("isAn yRoleAllow edAccess r eturns fal se, key se curity con straint is  '" + secu rityConstr aint.getDi splayName( ) + "'");
  93                                      return f alse;
  94                             }
  95                             if( se curityCons traint.get AuthConstr aint() &&  securityCo nstraint.f indAuthRol e("*") )
  96                             {
  97                                      logger.d ebug("isAn yRoleAllow edAccess,  found wild card secur ity constr aint '" +  securityCo nstraint.g etDisplayN ame() + "' ");
  98                                      allowAcc ess = true ;
  99                             }
  100                             
  101                             // che ck for eac h of the r oles, if a ny are lis ted then g rant acces s
  102                             for(St ring role:  roles)
  103                             {
  104                                      logger.d ebug("isAn yRoleAllow edAccess,  checking r ole '" + r ole + "'") ;
  105                                      if( secu rityConstr aint.getAu thConstrai nt() && se curityCons traint.fin dAuthRole( role) )
  106                                      {
  107                                               logger.deb ug("isAnyR oleAllowed Access, fo und securi ty constra int '" + s ecurityCon straint.ge tDisplayNa me() + "'  matching r ole '" + r ole + "'") ;
  108                                               allowAcces s = true;
  109                                      }
  110                             }
  111                    }
  112                    
  113                    logg er.debug(" isAnyRoleA llowedAcce ss returns  " + allow Access + " '" );
  114                    retu rn allowAc cess;
  115           }
  116           
  117   }