Produced by Araxis Merge on 3/24/2017 5:17:18 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_hooks\mhv-liferay-login-hook\src\main\java\gov\va\med\mhv\login\hook | CustomPreSessionExpireAction.java | Mon Nov 28 16:39:24 2016 UTC |
| 2 | MHV_2017.2.0.0 Code In Flight.zip\National Portal\mhv_hooks\mhv-liferay-login-hook\src\main\java\gov\va\med\mhv\login\hook | CustomPreSessionExpireAction.java | Fri Mar 24 20:18:10 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 224 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | /** | |
| 2 | * Perform user pre- timeout ac tions | |
| 3 | */ | |
| 4 | package go v.va.med.m hv.login.h ook; | |
| 5 | ||
| 6 | import jav a.util.Dat e; | |
| 7 | ||
| 8 | import jav ax.servlet .http.Http Session; | |
| 9 | ||
| 10 | import org .springfra mework.ste reotype.Co mponent; | |
| 11 | ||
| 12 | import com .liferay.p ortal.kern el.events. SessionAct ion; | |
| 13 | import com .liferay.p ortal.kern el.events. ActionExce ption; | |
| 14 | import com .liferay.p ortal.kern el.log.Log ; | |
| 15 | import com .liferay.p ortal.kern el.log.Log FactoryUti l; | |
| 16 | import com .liferay.p ortal.secu rity.auth. AuthExcept ion; | |
| 17 | ||
| 18 | import gov .va.med.mh v.common.a pi.excepti on.MHVExce ption; | |
| 19 | import gov .va.med.mh v.login.ho ok.SystemD ownExcepti on.ErrorCo deEnum; | |
| 20 | import gov .va.med.mh v.usermgmt .common.dt o.Activity DTO; | |
| 21 | import gov .va.med.mh v.usermgmt .common.en ums.Activi tyActionTy peEnumerat ion; | |
| 22 | import gov .va.med.mh v.usermgmt .common.en ums.Perfor merTypeEnu meration; | |
| 23 | import gov .va.med.mh v.usermgmt .service.A ccountVali datorServi ce; | |
| 24 | ||
| 25 | ||
| 26 | /** | |
| 27 | * @author DN S | |
| 28 | * | |
| 29 | */ | |
| 30 | @Component | |
| 31 | public cla ss CustomP reSessionE xpireActio n extends SessionAct ion { | |
| 32 | ||
| 33 | pr ivate stat ic Log log = LogFact oryUtil.ge tLog(Custo mPreSessio nExpireAct ion.class) ; | |
| 34 | ||
| 35 | pr ivate stat ic final S tring SESS ION_USERNA ME_KEY = " LIFERAY_SH ARED_useri d"; | |
| 36 | pr ivate stat ic final S tring SESS ION_USERPR OFILEID_KE Y = "LIFER AY_SHARED_ userprofil eid"; | |
| 37 | pr ivate Acco untValidat orService accountVal idatorServ ice; | |
| 38 | pr ivate stat ic final S tring PRE_ SESSION_EX PIRE = "Cu stomPreSes sionExpire Action"; | |
| 39 | ||
| 40 | ||
| 41 | // When user session ti mes out an AAL entry is added to Activit y table fo r audit pu rposes | |
| 42 | @Overr ide | |
| 43 | public void run( HttpSessio n session) throws Ac tionExcept ion { | |
| 44 | ||
| 45 | try { | |
| 46 | String username= null; | |
| 47 | Long u serProfile Id=null; | |
| 48 | if(ses sion!=null ){ | |
| 49 | if(sessi on.getAttr ibute(SESS ION_USERNA ME_KEY) != null){ | |
| 50 | username = (String)s ession.get Attribute( SESSION_US ERNAME_KEY ); | |
| 51 | } | |
| 52 | if(sessi on.getAttr ibute(SESS ION_USERPR OFILEID_KE Y) != null ){ | |
| 53 | userProfil eId= (Long )session.g etAttribut e(SESSION_ USERPROFIL EID_KEY); | |
| 54 | } | |
| 55 | }else{ | |
| 56 | if(log.i sDebugEnab led()){ | |
| 57 | log.debug( "****Sessi on is null ****"); | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | if(use rname != n ull && us erProfileI d != null) { | |
| 62 | //HttpSe ssion sess ion = Port alSessionT hreadLocal .getHttpSe ssion(); | |
| 63 | //String expires = (String)s ession.get Attribute( API_SESSIO N_EXP_KEY) ; | |
| 64 | // Creat e AAL entr y | |
| 65 | createTi meoutActiv ity(userna me,userPro fileId); | |
| 66 | session. setAttribu te(PRE_SES SION_EXPIR E,"yes"); | |
| 67 | } | |
| 68 | ||
| 69 | } ca tch (Excep tion e) { | |
| 70 | log.er ror("Error in Custom PreSession ExpireActi on for use r: ", e); | |
| 71 | } | |
| 72 | ||
| 73 | } | |
| 74 | ||
| 75 | pr ivate void createTim eoutActivi ty(String username, Long userP rofileId) throws Aut hException { | |
| 76 | ||
| 77 | if(l og.isDebug Enabled()) { | |
| 78 | log.de bug("Creat ing Accoun t Activity Log - MHV Timeout") ; | |
| 79 | } | |
| 80 | ||
| 81 | try { | |
| 82 | Activi tyDTO time outActivit y = new Ac tivityDTO( ); | |
| 83 | timeou tActivity. setAction( ActivityAc tionTypeEn umeration. SESSION_TI MEOUT.getD escription ()); | |
| 84 | timeou tActivity. setActivit yType("Log out"); | |
| 85 | timeou tActivity. setUserPro fileId(use rProfileId ); | |
| 86 | timeou tActivity. setStatus( Boolean.TR UE); | |
| 87 | timeou tActivity. setPerform erType(Per formerType Enumeratio n.valueOf( "System"). toString() ); | |
| 88 | timeou tActivity. setDetailV alue("None "); | |
| 89 | timeou tActivity. setComplet ionTime(ne w Date()); | |
| 90 | ||
| 91 | //getA ccountActi vityCreato rService() .createAcc ountActivi tyLog(time outActivit y); | |
| 92 | // Usi ng Account ValidatorS ervice ins tead of Ac countActiv ityCreator Service be cause of t he constra ints of se rvice call s from hoo ks | |
| 93 | getAcc ountValida torService ().createA ccountActi vityLog(ti meoutActiv ity); | |
| 94 | ||
| 95 | } ca tch (MHVEx ception e) { | |
| 96 | log.er ror("Error Creating Account Ac tivity Log - Session timeout", e); | |
| 97 | throw new AuthEx ception("E rror Creat ing Accoun t Activity Log Servi ce.", new SystemDown Exception( ErrorCodeE num.USER_M ANAGMENT_F AILURE_POS T_LOGIN_UP DATE, e)); | |
| 98 | } | |
| 99 | ||
| 100 | if(l og.isDebug Enabled()) { | |
| 101 | log.de bug("Accou nt Activit y Log - Se ssion time out create d"); | |
| 102 | } | |
| 103 | } | |
| 104 | ||
| 105 | pr ivate Acco untValidat orService getAccount ValidatorS ervice() { | |
| 106 | if ( this.accou ntValidato rService = = null) { | |
| 107 | this.a ccountVali datorServi ce = (Acco untValidat orService) Applicati onContextP rovider.ge tApplicati onContext( ) | |
| 108 | .getBean(" accountVal idatorServ iceProxy") ; | |
| 109 | } | |
| 110 | ||
| 111 | retu rn this.ac countValid atorServic e; | |
| 112 | } | |
| 113 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.