Produced by Araxis Merge on 4/18/2019 5:55:12 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 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_API_Core\src\tas\test\https-certs | index.js | Wed Apr 3 02:27:56 2019 UTC |
2 | MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_API_Core\src\tas\test\https-certs | index.js | Mon Apr 15 17:25:40 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 100 |
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 | //+ setup with | |
2 | //+ | |
3 | //+ docker run -w /a -v `pwd`: /a node:8- alpine npm install | |
4 | //+ | |
5 | //+ run wi th | |
6 | //+ | |
7 | //+ docker run --rm --name htt ps -w /a - v `pwd`:/a -p 443:44 3 node:8-a lpine node index.js | |
8 | //+ | |
9 | //+ call w ith | |
10 | //+ | |
11 | //+ curl - sk --cert ./kvtest-c lient.crt --key ./kv test-clien t.key http s:// IP | |
12 | //+ | |
13 | ||
14 | const expr ess = requ ire('expre ss') | |
15 | const fs = require(' fs') | |
16 | const http s = requir e('https') | |
17 | const app = express( ) | |
18 | ||
19 | const opti ons = { | |
20 | key: f s.readFile Sync('kvte st-server. key'), | |
21 | cert: fs.readFil eSync('kvt est-server .crt'), | |
22 | ca: fs .readFileS ync('kvtes t-ca-clien t.crt'), | |
23 | reques tCert: tru e, | |
24 | reject Unauthoriz ed: false | |
25 | } | |
26 | ||
27 | app.use((r eq, res, n ext) => { | |
28 | let lo g = new Da te() + ' ' + req.con nection.re moteAddres s + ' ' + req.method + ' ' + r eq.url | |
29 | let ce rt = req.s ocket.getP eerCertifi cate() | |
30 | if (ce rt.subject ) { | |
31 | lo g += ' ' + cert.subj ect.CN | |
32 | } | |
33 | next() | |
34 | }) | |
35 | ||
36 | app.use((r eq, res, n ext) => { | |
37 | if (!r eq.client. authorized ) { | |
38 | re turn res.s tatus(401) .send('una uthorized\ n') | |
39 | } | |
40 | next() | |
41 | }) | |
42 | ||
43 | app.use((r eq, res, n ext) => { | |
44 | return res.statu s(200).sen d('success \n') | |
45 | next() | |
46 | }) | |
47 | ||
48 | const serv er = https .Server(op tions, app ) | |
49 | server.lis ten(443, f unction () { | |
50 | consol e.log('lis tening on port ' + s erver.addr ess().port ) | |
51 | }) |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.