Produced by Araxis Merge on 4/8/2019 1:00:39 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 | C:\AraxisMergeCompare\Pri_un\crp-fitheart-release-2.0\app\src\core\services | auth_service.js | Wed Mar 20 17:30:00 2019 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\MHED P3 Healthshare 2.0-redacted\crp-fitheart-release-2.0\app\src\core\services | auth_service.js | Mon Apr 8 14:58:16 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 254 |
| 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 | define(['a ngular', ' app', 'pag e_service' , 'Patient FHIRServic e'], funct ion (angul ar, app) { | |
| 2 | "u se strict" ; | |
| 3 | ap p.service( 'authentic ationServi ce', | |
| 4 | func tion ($htt p, $q, $wi ndow, $loc ation, $ro otScope, $ injector, pageServic e, Patient FHIRServic e, localRe sourceDire ctoryServi ce) { | |
| 5 | var _a uth = {}, | |
| 6 | isAuthen ticated, | |
| 7 | jwtCookieN ame = ' DNS ', | |
| 8 | vamfJwtT oken = {}; | |
| 9 | ||
| 10 | _auth. deleteCook ie = funct ion (cooki eName) { | |
| 11 | document .cookie = encodeURIC omponent(c ookieName) + 'domai n=' + docu ment.domai n + ';path =/;' + 'ex pires=' + new Date(0 ).toUTCStr ing(); | |
| 12 | }; | |
| 13 | ||
| 14 | _auth. gotoLogout WithRedire ct = funct ion () { | |
| 15 | localRes ourceDirec toryServic e.fetch(). then(funct ion (direc tory) { | |
| 16 | var logout Url = dire ctory['use rs-logout' ]; | |
| 17 | window.ope n(logoutUr l, "_self" ); | |
| 18 | }); | |
| 19 | }; | |
| 20 | ||
| 21 | _auth. authorize = function () { | |
| 22 | localRes ourceDirec toryServic e.fetch(). then(funct ion(direct ory){ | |
| 23 | var url = directory[ 'users-log in'] + '?r edirect_ur i=/fit-hea rt/'; | |
| 24 | _auth.goto LoginWithR edirect(ur l); | |
| 25 | }) | |
| 26 | }; | |
| 27 | ||
| 28 | _auth. gotoLoginW ithRedirec t = functi on (loginU rl) { | |
| 29 | window.l ocation.hr ef = login Url; | |
| 30 | }; | |
| 31 | ||
| 32 | _auth. authentica te = funct ion () { | |
| 33 | var defe rred = $q. defer(); | |
| 34 | var auth enticated = _auth.is Authentica ted(); | |
| 35 | if (!aut henticated ) { | |
| 36 | _auth.auth orize(); | |
| 37 | deferred.r eject(auth enticated) ; | |
| 38 | } else { | |
| 39 | deferred.r esolve(aut henticated ); | |
| 40 | } | |
| 41 | ||
| 42 | return d eferred.pr omise; | |
| 43 | }; | |
| 44 | ||
| 45 | _auth. isAuthenti cated = fu nction () { | |
| 46 | return i sAuthentic ated; | |
| 47 | }; | |
| 48 | ||
| 49 | _auth. checkAuthS tatus = fu nction () { | |
| 50 | if (requ est) { | |
| 51 | return req uest.promi se; | |
| 52 | } | |
| 53 | var requ est = $q.d efer(); | |
| 54 | _auth.ch eckJwtToke n().then(f unction (r esponse) { | |
| 55 | isAuthenti cated = re sponse; | |
| 56 | ||
| 57 | if (isAuth enticated) { | |
| 58 | $i njector.in voke(['con nectionTim eoutServic e', functi on (connec tionTimeou tService) { | |
| 59 | conn ectionTime outService .run(); | |
| 60 | }] ); | |
| 61 | } | |
| 62 | ||
| 63 | request.re solve(isAu thenticate d); | |
| 64 | }, funct ion (error ) { | |
| 65 | request.re ject(error ); | |
| 66 | }); | |
| 67 | ||
| 68 | return r equest.pro mise; | |
| 69 | }; | |
| 70 | ||
| 71 | ||
| 72 | _auth. checkJwtTo ken = func tion () { | |
| 73 | if (done ) { | |
| 74 | return don e.promise; | |
| 75 | } | |
| 76 | var done = $q.defe r(); | |
| 77 | var vali dToken = f alse; | |
| 78 | vamfJwtT oken = get Cookie(); | |
| 79 | if (vamf JwtToken) { | |
| 80 | // get pat ient paylo ad from co okie | |
| 81 | var tokenD ata = pars eJwt(vamfJ wtToken) | |
| 82 | if (tokenD ata.authen ticated) { | |
| 83 | va lidToken = true; | |
| 84 | Pa tientFHIRS ervice.set PatientCon text(token Data.patie nt).then(f unction (s uccess) { | |
| 85 | if ( !success) { | |
| 86 | consol e.error("T here was a n error wh ile settin g PatientC ontext"); | |
| 87 | } | |
| 88 | done .resolve(v alidToken) ; | |
| 89 | }, function (error) { | |
| 90 | done .reject(er ror); | |
| 91 | }) ; | |
| 92 | } else { | |
| 93 | do ne.reject( validToken ); | |
| 94 | } | |
| 95 | } else { | |
| 96 | done.rejec t({error: 'empty tok en'}); | |
| 97 | } | |
| 98 | ||
| 99 | return d one.promis e; | |
| 100 | }; | |
| 101 | ||
| 102 | _auth. getParsedT oken = fun ction () { | |
| 103 | var toke nData = {} ; | |
| 104 | vamfJwtT oken = get Cookie(); | |
| 105 | if (vamf JwtToken) { | |
| 106 | tokenData = parseJwt (vamfJwtTo ken); | |
| 107 | } | |
| 108 | ||
| 109 | return t okenData; | |
| 110 | }; | |
| 111 | ||
| 112 | // hel per functi ons | |
| 113 | var ge tCookie = function ( ) { | |
| 114 | var cook ieName = j wtCookieNa me; | |
| 115 | var b = document.c ookie.matc h('(^|;)\\ s*' + cook ieName + ' \\s*=\\s*( [^;]+)'); | |
| 116 | return b ? b.pop() : ''; | |
| 117 | } | |
| 118 | var pa rseJwt = f unction (t oken) { | |
| 119 | var base 64String = token.spl it('.')[1] ; | |
| 120 | var base 64 = base6 4String.sp lit('-').j oin('+').s plit('_'). join('/'); | |
| 121 | return J SON.parse( window.ato b(base64)) ; | |
| 122 | }; | |
| 123 | ||
| 124 | _auth. parseJwt = parseJwt; | |
| 125 | ||
| 126 | return _auth; | |
| 127 | }); | |
| 128 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.