Produced by Araxis Merge on 10/5/2018 9:05: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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MHEDP3_VAOS_VATS_SM_Sept2018.zip\SM 2.4.0\scheduling-manager-resources-2.4.0.zip\SchedulingManagerService\src\inttest\java\com\agilex\healthcare\schedulingmanager\clientapi | JerseyFactory.java | Thu Jul 19 20:06:36 2018 UTC |
| 2 | MHEDP3_VAOS_VATS_SM_Sept2018.zip\SM 2.4.0\scheduling-manager-resources-2.4.0.zip\SchedulingManagerService\src\inttest\java\com\agilex\healthcare\schedulingmanager\clientapi | JerseyFactory.java | Fri Oct 5 19:44:14 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 152 |
| 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 | package co m.agilex.h ealthcare. scheduling manager.cl ientapi; | |
| 2 | ||
| 3 | import com .agilex.he althcare.s chedulingm anager.cli entapi.Aut henticatio nInfo; | |
| 4 | import com .agilex.he althcare.s chedulingm anager.cli entapi.HTT POAuthFilt er; | |
| 5 | //import c om.agilex. healthcare .schedulin gmanager.c lientapi.O authClient ; | |
| 6 | import com .agilex.he althcare.s chedulingm anager.tes tutility.I ntegration TestConfig uration; | |
| 7 | import com .sun.jerse y.api.clie nt.Client; | |
| 8 | import com .sun.jerse y.api.clie nt.filter. ClientFilt er; | |
| 9 | import com .sun.jerse y.api.clie nt.filter. HTTPBasicA uthFilter; | |
| 10 | import com .sun.jerse y.api.clie nt.filter. HTTPDigest AuthFilter ; | |
| 11 | ||
| 12 | public cla ss JerseyF actory { | |
| 13 | pr ivate stat ic final S tring DIGE ST_AUTHENT ICATION = "digest"; | |
| 14 | pr ivate stat ic final S tring BASI C_AUTHENTI CATION = " basic"; | |
| 15 | pr ivate stat ic final S tring OAUT H_AUTHENTI CATION = " oauth"; | |
| 16 | pr ivate stat ic final o rg.apache. commons.lo gging.Log logger = o rg.apache. commons.lo gging.LogF actory.get Log(Jersey Factory.cl ass); | |
| 17 | ||
| 18 | pu blic stati c com.sun. jersey.api .client.Cl ient creat eJerseyCli ent(Authen ticationIn fo authent icationInf o) { | |
| 19 | Clie nt jerseyc lient = ne w com.sun. jersey.api .client.Cl ient(); | |
| 20 | logg er.debug(" creating j ersey clie nt"); | |
| 21 | ||
| 22 | if ( authentica tionInfo ! = null) { | |
| 23 | Client Filter aut hFilter = null; | |
| 24 | String username = authenti cationInfo .getUserna me(); | |
| 25 | String password = authenti cationInfo .getPasswo rd(); | |
| 26 | String facilityN ame = auth entication Info.getFa cilityName (); | |
| 27 | String facilityC ode = auth entication Info.getFa cilityCode (); | |
| 28 | ||
| 29 | if (au thenticati onInfo.get Authtype() .toLowerCa se().conte ntEquals(B ASIC_AUTHE NTICATION) ) { | |
| 30 | logger.d ebug(Strin g.format(" creating b asic auth filter [%s ][%s]", us ername, pa ssword)); | |
| 31 | authFilt er = new H TTPBasicAu thFilter(u sername, p assword); | |
| 32 | } else if (authe nticationI nfo.getAut htype().to LowerCase( ).contentE quals(DIGE ST_AUTHENT ICATION)) { | |
| 33 | logger.d ebug(Strin g.format(" creating d igest auth filter [% s][%s]", u sername, p assword)); | |
| 34 | authFilt er = new H TTPDigestA uthFilter( username, password); | |
| 35 | } else if (authe nticationI nfo.getAut htype().to LowerCase( ).contentE quals(OAUT H_AUTHENTI CATION)) { | |
| 36 | logger.d ebug(Strin g.format(" creating d igest auth filter [% s][%s]", u sername, p assword)); | |
| 37 | String a ccessToken = retriev eOauthToke n(username , password , facility Name, faci lityCode); | |
| 38 | authFilt er = new H TTPOAuthFi lter(acces sToken); | |
| 39 | } | |
| 40 | ||
| 41 | if (au thFilter = = null) | |
| 42 | throw ne w RuntimeE xception(" Invalid au thenticati on type " + authenti cationInfo .getAuthty pe()); | |
| 43 | ||
| 44 | jersey client.add Filter(aut hFilter); | |
| 45 | } | |
| 46 | retu rn jerseyc lient; | |
| 47 | } | |
| 48 | ||
| 49 | pr ivate stat ic String retrieveOa uthToken(S tring user name, Stri ng passwor d, String facilityNa me, String facilityC ode) { | |
| 50 | Auth entication Info authe nticationI nfo = cons tructAuthI nfo(userna me, passwo rd, facili tyName, fa cilityCode ); | |
| 51 | Oaut hClient oa uthClient = new Oaut hClient(); | |
| 52 | Stri ng accessT oken; | |
| 53 | try { | |
| 54 | access Token = oa uthClient. authentica te(authent icationInf o, null); | |
| 55 | } ca tch (Runti meExceptio n e) { | |
| 56 | throw e; | |
| 57 | } ca tch (Excep tion e) { | |
| 58 | throw new Runtim eException (e); | |
| 59 | } | |
| 60 | retu rn accessT oken; | |
| 61 | } | |
| 62 | ||
| 63 | pr ivate stat ic Authent icationInf o construc tAuthInfo( String use rname, Str ing passwo rd, String facilityN ame, Strin g facility Code) { | |
| 64 | Auth entication Info authI nfo = new Authentica tionInfo() ; | |
| 65 | auth Info.setUs ername(use rname); | |
| 66 | auth Info.setPa ssword(pas sword); | |
| 67 | auth Info.setFa cilityName (facilityN ame); | |
| 68 | auth Info.setFa cilityCode (facilityC ode); | |
| 69 | auth Info.setCl ientId("Mo bileBlueBu tton"); | |
| 70 | authInfo.s etClientSe cret(" AI "); | |
| 71 | auth Info.setEx pectAuthen ticationRe quired(tru e); | |
| 72 | auth Info.setAu thorizeUrl (Integrati onTestConf iguration. getMHPAuth orizeURI() ); | |
| 73 | auth Info.setTo kenUrl(Int egrationTe stConfigur ation.getM HPTokenURI ()); | |
| 74 | retu rn authInf o; | |
| 75 | } | |
| 76 | ||
| 77 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.