Produced by Araxis Merge on 6/20/2017 7:20:06 AM 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.
# | Location | File | Last Modified |
---|---|---|---|
1 | CIF_MHV_2017.3.0.0_SW_Docx.zip\CIF_MHV_2017.3.0.0.zip\mhv_source\mhv_hooks\mhv-liferay-login-hook\src\main\java\gov\va\med\mhv\login\hook | CustomPreSessionExpireAction.java | Sat Jun 3 17:36:50 2017 UTC |
2 | CIF_MHV_2017.3.0.0_SW_Docx.zip\CIF_MHV_2017.3.0.0.zip\mhv_source\mhv_hooks\mhv-liferay-login-hook\src\main\java\gov\va\med\mhv\login\hook | CustomPreSessionExpireAction.java | Mon Jun 19 16:33:37 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 196 |
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 RED A CTED | |
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 | ||
39 | // When user session ti mes out an AAL entry is added to Activit y table fo r audit pu rposes | |
40 | @Overr ide | |
41 | public void run( HttpSessio n session) throws Ac tionExcept ion { | |
42 | try { | |
43 | String username= null; | |
44 | Long u serProfile Id=null; | |
45 | if(ses sion!=null ){ | |
46 | if(sessi on.getAttr ibute(SESS ION_USERNA ME_KEY) != null){ | |
47 | username = (String)s ession.get Attribute( SESSION_US ERNAME_KEY ); | |
48 | } | |
49 | if(sessi on.getAttr ibute(SESS ION_USERPR OFILEID_KE Y) != null ){ | |
50 | userProfil eId= (Long )session.g etAttribut e(SESSION_ USERPROFIL EID_KEY); | |
51 | } | |
52 | }else{ | |
53 | if(log.i sDebugEnab led()){ | |
54 | log.debug( "****Sessi on is null ****"); | |
55 | } | |
56 | } | |
57 | ||
58 | if(use rname != n ull && us erProfileI d != null) { | |
59 | // Creat e AAL entr y | |
60 | if (sess ion.getAtt ribute("re questURL") == null | | !session .getAttrib ute("reque stURL").to String().c ontains("p ortal/logo ut")){ | |
61 | // AAL ent ry | |
62 | createTime outActivit y(username ,userProfi leId); | |
63 | } | |
64 | } | |
65 | } ca tch (Excep tion e) { | |
66 | log.er ror("Error in Custom PreSession ExpireActi on for use r: ", e); | |
67 | } | |
68 | ||
69 | } | |
70 | ||
71 | pr ivate void createTim eoutActivi ty(String username, Long userP rofileId) throws Aut hException { | |
72 | try { | |
73 | Activi tyDTO time outActivit y = new Ac tivityDTO( ); | |
74 | timeou tActivity. setAction( ActivityAc tionTypeEn umeration. SESSION_TI MEOUT.getD escription ()); | |
75 | timeou tActivity. setActivit yType("Log out"); | |
76 | timeou tActivity. setUserPro fileId(use rProfileId ); | |
77 | timeou tActivity. setStatus( Boolean.TR UE); | |
78 | timeou tActivity. setPerform erType(Per formerType Enumeratio n.valueOf( "System"). toString() ); | |
79 | timeou tActivity. setDetailV alue("None "); | |
80 | timeou tActivity. setComplet ionTime(ne w Date()); | |
81 | ||
82 | //getA ccountActi vityCreato rService() .createAcc ountActivi tyLog(time outActivit y); | |
83 | // 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 | |
84 | getAcc ountValida torService ().createA ccountActi vityLog(ti meoutActiv ity); | |
85 | ||
86 | } ca tch (MHVEx ception e) { | |
87 | log.er ror("Error Creating Account Ac tivity Log - Session timeout", e); | |
88 | 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)); | |
89 | } | |
90 | } | |
91 | ||
92 | pr ivate Acco untValidat orService getAccount ValidatorS ervice() { | |
93 | if ( this.accou ntValidato rService = = null) { | |
94 | this.a ccountVali datorServi ce = (Acco untValidat orService) Applicati onContextP rovider.ge tApplicati onContext( ) | |
95 | .getBean(" accountVal idatorServ iceProxy") ; | |
96 | } | |
97 | retu rn this.ac countValid atorServic e; | |
98 | } | |
99 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.