Produced by Araxis Merge on 12/8/2017 1:33:40 PM Central Standard 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 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\fpps-app-server\server\routes\login | login.js | Fri Dec 8 17:52:34 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Frontend\fpps-app\fpps-app-server\server\routes\login | login.js | Fri Dec 8 19:06:06 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 220 |
| 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 | const expr ess = requ ire('expre ss'); | |
| 2 | const rout er = expre ss.Router( ); | |
| 3 | var Client = require ('node-res t-client') .Client; | |
| 4 | var client = new Cli ent(); | |
| 5 | var btoa = require(' btoa'); | |
| 6 | var userna me = 'FPPS _FRONTEND_ APP'; | |
| 7 | var passwo rd = 'fpps 123456'; | |
| 8 | ||
| 9 | router.get ('/authPar ams', (req , res) => { | |
| 10 | getAcces sToken( | |
| 11 | proces s.env.END_ POINT_BASE _URI + pro cess.env.T OKEN_REQUE ST | |
| 12 | ).then(r esponse => { | |
| 13 | access _token = ' Bearer ' + response[ 'access_to ken']; | |
| 14 | getRes ource( | |
| 15 | acce ss_token, | |
| 16 | guid , | |
| 17 | proc ess.env.EN D_POINT_BA SE_URI + p rocess.env .AUTH_INIT _PARAMS | |
| 18 | ).then (response => { | |
| 19 | res. status(200 ).json(res ponse); | |
| 20 | }); | |
| 21 | }); | |
| 22 | }); | |
| 23 | ||
| 24 | router.pos t('/roles' , (req, re s) => { | |
| 25 | let g = req.body.b ody.c; | |
| 26 | if (g == '1000') { | |
| 27 | guid = process.e nv.READ_ON LY_GUID; | |
| 28 | } | |
| 29 | if (g == '2000') { | |
| 30 | guid = process.e nv.FEE_VIS N_PGM_MANA GER_GUID; | |
| 31 | } | |
| 32 | if (g == '3000') { | |
| 33 | guid = process.e nv.ADMIN_G UID; | |
| 34 | } | |
| 35 | getAcces sToken( | |
| 36 | proces s.env.END_ POINT_BASE _URI + pro cess.env.T OKEN_REQUE ST | |
| 37 | ).then(r esponse => { | |
| 38 | access _token = ' Bearer ' + response[ 'access_to ken']; | |
| 39 | getRes ource( | |
| 40 | acce ss_token, | |
| 41 | guid , | |
| 42 | proc ess.env.EN D_POINT_BA SE_URI + p rocess.env .USER_ROLE S | |
| 43 | ).then (response2 => { | |
| 44 | //co nsole.log( 'response' , response 2); | |
| 45 | res. status(200 ).json(res ponse2); | |
| 46 | }); | |
| 47 | }); | |
| 48 | //consol e.log('gui d', guid); | |
| 49 | }); | |
| 50 | ||
| 51 | // SSO cal ls this se rvice once authentic ation is d one | |
| 52 | router.get ('/userChe ck', (req, res) => { | |
| 53 | // con sole.log(" userCheck request h as been re ached!!"); | |
| 54 | // // Get the i and c para ms sent by the SSO a pplication manager | |
| 55 | // con sole.log(" i(guid) s ent by SSO is : ", r eq.query.i ); | |
| 56 | // con sole.log(" c(home pa ge url) se nt by SSO server is : ", req.q uery.c); | |
| 57 | res.redire ct('http:/ / SERVER : PORT /'); | |
| 58 | res.end( ' userChec k request has been p rocessed!' ); | |
| 59 | }); | |
| 60 | ||
| 61 | function g etAccessTo ken(url) { | |
| 62 | let full Authentica tion = 'Ba sic ' + bt oa(usernam e + ':' + password); | |
| 63 | let args = { | |
| 64 | parame ters: { | |
| 65 | gran t_type: 'p assword', | |
| 66 | user name: 'fpp s', | |
| 67 | pass word: 'mHq wnM}yT~={k 2' | |
| 68 | }, | |
| 69 | header s: { | |
| 70 | Auth orization: fullAuthe ntication, | |
| 71 | 'Con tent-Type' : 'applica tion/json' | |
| 72 | } | |
| 73 | }; | |
| 74 | ||
| 75 | let make RestCall = function( ) { | |
| 76 | return new Promi se(functio n(resolve, reject) { | |
| 77 | clie nt.post(ur l, args, f unction(da ta, respon se) { | |
| 78 | re solve(data ); | |
| 79 | }); | |
| 80 | }); | |
| 81 | }; | |
| 82 | ||
| 83 | let prom ise = make RestCall() ; | |
| 84 | ||
| 85 | return p romise; | |
| 86 | } | |
| 87 | ||
| 88 | function g etResource (access_to ken, guid, url) { | |
| 89 | var args = { | |
| 90 | parame ters: { | |
| 91 | guid : guid | |
| 92 | }, | |
| 93 | header s: { | |
| 94 | Auth orization: access_to ken, | |
| 95 | 'Con tent-Type' : 'applica tion/json' | |
| 96 | } | |
| 97 | }; | |
| 98 | const ma keRestCall = functio n() { | |
| 99 | return new Promi se(functio n(resolve, reject) { | |
| 100 | clie nt.get(url , args, fu nction(dat a, respons e) { | |
| 101 | co nsole.log( 'data ', d ata, 'resp onse ', re sponse.sta tusCode); | |
| 102 | re solve(data ); | |
| 103 | }); | |
| 104 | }); | |
| 105 | }; | |
| 106 | ||
| 107 | let prom ise = make RestCall() ; | |
| 108 | return p romise; | |
| 109 | } | |
| 110 | ||
| 111 | module.exp orts = rou ter; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.