45. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/24/2017 5:17:19 PM Eastern 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.

45.1 Files compared

# Location File Last Modified
1 MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_user\mhv-usermgmt-portal-data\src\main\java\gov\va\med\mhv\usermgmt\persist\ldap\spring UserSpringLDAPDaoImpl.java Mon Nov 21 22:43:26 2016 UTC
2 MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_user\mhv-usermgmt-portal-data\src\main\java\gov\va\med\mhv\usermgmt\persist\ldap\spring UserSpringLDAPDaoImpl.java Fri Mar 24 20:41:13 2017 UTC

45.2 Comparison summary

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

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

45.4 Active regular expressions

No regular expressions were active.

45.5 Comparison detail

  1   package go v.va.med.m hv.usermgm t.persist. ldap.sprin g;
  2  
  3   import jav ax.naming. Name;
  4   import jav ax.naming. NamingExce ption;
  5   import jav ax.naming. directory. Attribute;
  6   import jav ax.naming. directory. Attributes ;
  7   import jav ax.naming. directory. BasicAttri bute;
  8   import jav ax.naming. directory. BasicAttri butes;
  9   import jav ax.naming. directory. DirContext ;
  10   import jav ax.naming. directory. Modificati onItem;
  11   import jav ax.naming. ldap.LdapC ontext;
  12  
  13   import org .apache.lo gging.log4 j.LogManag er;
  14   import org .apache.lo gging.log4 j.Logger;
  15   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  16   import org .springfra mework.bea ns.factory .annotatio n.Value;
  17   import org .springfra mework.lda p.core.Lda pTemplate;
  18   import org .springfra mework.lda p.support. LdapNameBu ilder;
  19   import org .springfra mework.ste reotype.Co mponent;
  20  
  21   import gov .va.med.mh v.common.a pi.dto.Use rProfileDT O;
  22   import gov .va.med.mh v.usermgmt .exception .MHVUserDo esNotExist Exception;
  23   import gov .va.med.mh v.usermgmt .persist.U serEntryDa o;
  24   import gov .va.med.mh v.usermgmt .persist.l dap.LdapEn vironment;
  25  
  26   /**
  27    * UserDao  implement ation that  writes to  a directo ry server.
  28    *
  29    * @author   PII  Apr 4, 20 06 3:51:19  PM
  30    */
  31  
  32   @Component
  33   public cla ss UserSpr ingLDAPDao Impl imple ments User EntryDao {
  34  
  35           pr ivate stat ic Logger  log = LogM anager.get Logger(Use rSpringLDA PDaoImpl.c lass);
  36           
  37           @A utowired
  38           pr ivate Ldap Environmen t env;
  39  
  40           @A utowired
  41           pr ivate Ldap Template l dapTemplat e;
  42  
  43           /* *
  44            *  Reset the  password  of the use r represen ted by the  userName  parameter.
  45            *  
  46            *  @param us erName
  47            *  @param ne wPassword
  48            * /
  49           pu blic void  resetPassw ord(String  userName,  String ne wPassword)  {
  50                    
  51                    Ldap Context co ntext = (L dapContext )ldapTempl ate.getCon textSource ().getRead WriteConte xt();
  52                    
  53                    fina l Modifica tionItem[]  modificat ions = new  Modificat ionItem[1] ;
  54                    modi fications[ 0] = new M odificatio nItem(DirC ontext.REP LACE_ATTRI BUTE, new  BasicAttri bute(env.g etUserPass wordAttrib ute(), new Password)) ;
  55                    
  56                    try  {
  57                             contex t.modifyAt tributes(b uildDn(use rName), mo dification s);
  58                    } ca tch (Namin gException  e) {
  59                             throw  new MHVUse rDoesNotEx istExcepti on(e);
  60                    } 
  61  
  62           }
  63  
  64           /* *
  65            *  Change th e userName  of the us er represe nted by th e oldUserN ame parame ter.
  66            *  
  67            *  @param ol dUserName
  68            *  @param ne wUserName
  69            * /
  70           // TODO: Impl ement it w hen needed
  71           pu blic void  changeUser Name(Strin g oldUserN ame, Strin g newUserN ame) {
  72   /*                thi s.connect( newUserNam e);
  73                     lda pUpdate.ad dCommand(L dapEntryMo dification .wipeAndRe place(Ldap Util.build UserDn(env ,
  74                     old UserName),  Collectio ns.EMPTY_M AP));
  75                     lda pUpdate.ex ecuteUpdat e();*/
  76           }
  77  
  78           /* *
  79            *  Create a  user entry  in the di rectory.
  80            *  
  81            *  @param us erName
  82            *              The valu e that wil l be writt en to the  uid, cn an d sn
  83            *              attribut es of the  newly crea ted entry.
  84            *  @param pa ssword
  85            *              The valu e that wil l be encry pted and w ritten to  the passwo rd
  86            *              attribut e of the n ewly creat ed entry.
  87            * /
  88  
  89           /* *
  90            *  (non-Java doc)
  91            *
  92            *  @see ldap .advance.e xample.Use rRepositor y#createUs er(ldap.ad vance.exam ple.User)
  93            * /
  94  
  95           pu blic void  createUser (UserProfi leDTO user ) {
  96                    log. info("exec uting {cre ateUser}") ;
  97                    Stri ng userNam e = user.g etUserName ();
  98  
  99                    Attr ibute obje ctClass =  new BasicA ttribute(" objectClas s");
  100                    {
  101                             object Class.add( "top");
  102                             object Class.add( "uidObject ");
  103                             object Class.add( "person");
  104                             object Class.add( "organizat ionalPerso n");
  105                    }
  106  
  107                    Attr ibutes use rAttribute s = new Ba sicAttribu tes();
  108                    user Attributes .put(objec tClass);
  109                    user Attributes .put(env.g etUserName Attribute( ), userNam e);
  110                    user Attributes .put(env.g etUserPass wordAttrib ute(), use r.getPassw ord());
  111                    user Attributes .put(env.g etCommonNa meAttribut e(), userN ame);
  112                    user Attributes .put(env.g etSurNameA ttribute() , userName );
  113  
  114                    ldap Template.b ind(buildD n(userName ), null, u serAttribu tes);
  115           }
  116  
  117           /* *
  118            *  Remove th e user wit h the spec ified user Name from  the direct ory.
  119            *  
  120            *  @param us erName
  121            *              The user name to de lete.
  122            * /
  123           pu blic void  removeUser (String us erName) {
  124                    // r ecursively  remove th e person o bject
  125                    ldap Template.u nbind(buil dDn(userNa me));
  126           }
  127  
  128           pr ivate Name  buildDn(S tring uId)  {
  129                    retu rn LdapNam eBuilder.n ewInstance ()
  130                                      .add("ou ","People" )
  131                                      .add("ui d", uId )
  132                                      .build() ;
  133           }
  134  
  135  
  136           // TODO: impl ement this  when need ed
  137           pu blic boole an checkPa ssword(Str ing userNa me, String  password)  {
  138                    log. info("exec uting {aut henticate} ");
  139                    retu rn ldapTem plate.auth enticate(e nv.getUser BaseDn(),  "(uid="+ u serName +  ")", passw ord);
  140           }
  141  
  142           
  143   }