606. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/6/2017 8:23:35 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.

606.1 Files compared

# Location File Last Modified
1 OSCIF_CTT_v4_build 1.zip\VUID-rest\src\main\java\gov\vha\vuid\rest\session UserServiceUtils.java Wed May 31 03:59:14 2017 UTC
2 OSCIF_CTT_v4_build 1.zip\VUID-rest\src\main\java\gov\vha\vuid\rest\session UserServiceUtils.java Mon Jul 3 23:41:28 2017 UTC

606.2 Comparison summary

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

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

606.4 Active regular expressions

No regular expressions were active.

606.5 Comparison detail

  1   /**
  2    * Copyrig ht Notice
  3    *
  4    * This is  a work of  the U.S.  Government  and is no t subject  to copyrig ht
  5    * protect ion in the  United St ates. Fore ign copyri ghts may a pply.
  6    * 
  7    * License d under th e Apache L icense, Ve rsion 2.0  (the "Lice nse");
  8    * you may  not use t his file e xcept in c ompliance  with the L icense.
  9    * You may  obtain a  copy of th e License  at
  10    *
  11    * http:// www.apache .org/licen ses/LICENS E-2.0
  12    *
  13    * Unless  required b y applicab le law or  agreed to  in writing , software
  14    * distrib uted under  the Licen se is dist ributed on  an "AS IS " BASIS,
  15    * WITHOUT  WARRANTIE S OR CONDI TIONS OF A NY KIND, e ither expr ess or imp lied.
  16    * See the  License f or the spe cific lang uage gover ning permi ssions and
  17    * limitat ions under  the Licen se.
  18    */
  19  
  20   package go v.vha.vuid .rest.sess ion;
  21  
  22   import jav a.io.IOExc eption;
  23   import jav a.net.URL;
  24   import jav a.net.URLE ncoder;
  25   import jav a.util.Col lection;
  26   import jav a.util.Has hMap;
  27   import jav a.util.Has hSet;
  28   import jav a.util.Map ;
  29   import jav a.util.Set ;
  30   import jav a.util.UUI D;
  31   import org .apache.lo gging.log4 j.LogManag er;
  32   import org .apache.lo gging.log4 j.Logger;
  33   import com .fasterxml .jackson.c ore.JsonPa rseExcepti on;
  34   import com .fasterxml .jackson.d atabind.Js onMappingE xception;
  35   import com .fasterxml .jackson.d atabind.Ob jectMapper ;
  36   import gov .vha.isaac .ochre.api .User;
  37   import gov .vha.isaac .ochre.api .UserRole;
  38   import gov .vha.isaac .ochre.api .bootstrap .TermAux;
  39   import gov .vha.isaac .ochre.api .util.Uuid T5Generato r;
  40  
  41   /**
  42    * 
  43    * {@link  UserServic eUtils}
  44    *
  45    * @author  <a href=" mailto:joe l.kniaz.li st@gmail.c om">Joel K niaz</a>
  46    *
  47    */
  48   public cla ss UserSer viceUtils  {
  49           
  50           pr ivate stat ic Logger  log = LogM anager.get Logger(Use rServiceUt ils.class) ;
  51           
  52           st atic User  getUserFro mJson(Stri ng jsonToU se) throws  JsonParse Exception,  JsonMappi ngExceptio n, IOExcep tion {
  53                    Obje ctMapper m apper = ne w ObjectMa pper();
  54                    Map< ?, ?> map  = null;
  55                    map  = mapper.r eadValue(j sonToUse,  Map.class) ;
  56                    
  57                    Stri ng userNam e = (Strin g)map.get( "user");
  58                    Set< UserRole>  roleSet =  new HashSe t<>();
  59                    Coll ection<?>  roles = (C ollection< ?>)map.get ("roles");
  60                    for  (Object ro leMapObjec t : roles)  {
  61                             Map<?, ?> roleMap  = (Map<?, ?>)roleMap Object;
  62                             String  roleName  = (String) roleMap.ge t("name");
  63                             
  64                             roleSe t.add(User Role.safeV alueOf(rol eName).get ());
  65                    }
  66                    
  67                    fina l UUID uui dFromUserF sn = UserS erviceUtil s.getUuidF romUserNam e(userName );;
  68           
  69                    User  newUser =  new User( userName,  uuidFromUs erFsn, rol eSet);
  70                    
  71                    retu rn newUser ;
  72           }
  73  
  74           st atic UUID  getUuidFro mUserName( String use rName) {
  75                    retu rn UuidT5G enerator.g et(TermAux .USER.getP rimordialU uid(), use rName);
  76           }
  77  
  78           st atic User  getUserFro mUrl(URL u rl, String  ssoToken)  throws Js onParseExc eption, Js onMappingE xception,  IOExceptio n {
  79   //               /*
  80   //                * E xample URL  for get_r oles_by_to ken
  81   //                 * URL url  = new URL( "https:// DNS                        token=" +  token);
  82   //                */
  83   //               /*
  84   //                * E xample SSO  Token
  85   //                * % 5B%22u%5Cf %5Cx8F%5Cx B1X%5C%22% 5CxC2%5CxE E%5CxFA%5C xE1%5Cx94% 5CxBF3%5Cx A9%5Cx16K% 22%2C+%22% 7EK%5CxC4% 5CxEFXk%5C x80%5CxB1% 5CxA3%5CxF 3%5Cx8D%5C xB1%5Cx7F% 5CxBC%5Cx0 2K%22%2C+% 22k%5Cf%5C xDC%5CxF7% 2CP%5CxB2% 5Cx97%5Cx9 9%5Cx99%5C xE0%5CxE1% 7C%5CxBF%5 Cx1DK%22%2 C+%22J%5Cf %5Cx9B%5Cx D8w%5Cx15% 5CxFE%5CxD 3%5CxC7%5C xDC%5CxAC% 5Cx9E%5Cx1 C%5CxD0bG% 22%5D
  86   //                */
  87   //                //String j son = "{\" roles\":[{ \"id\":100 00,\"name\ ":\"read_o nly\",\"re source_id\ ":null,\"r esource_ty pe\":null, \"created_ at\":\"201 6-09-13T14 :48:18.000 Z\",\"upda ted_at\":\ "2016-09-1 3T14:48:18 .000Z\"}], \"token_pa rsed?\":tr ue,\"user\ ":\"
D NS    \",\"type\ ":\"ssoi\" ,\"id\":10 005}";
  88  
  89                    log. info("Atte mpting to  read user  from url ' {}'", url) ;
  90                    Map< String, St ring> para ms = new H ashMap<>() ;   
  91                    para ms.put("to ken", URLE ncoder.enc ode(ssoTok en, "UTF-8 "));
  92                    Stri ng jsonRes ultString  = PrismeSe rviceUtils .getResult JsonFromPr isme(Prism eServiceUt ils.getTar getFromUrl (url), url .getPath() , params);
  93                    
  94                    retu rn UserSer viceUtils. getUserFro mJson(json ResultStri ng);
  95           }
  96   }