Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add https support

  • Loading branch information...
commit e77b0aa01e7a08734e5f6817fea6892a55ff46fe 1 parent 1906f3b
@andriykuba authored
View
13 config/key/cert.pem
@@ -0,0 +1,13 @@
+-----BEGIN CERTIFICATE-----
+MIIB6DCCAZICCQDBNspGwagyMjANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJV
+QTENMAsGA1UECBMES3lpdjENMAsGA1UEBxMES3lpdjENMAsGA1UEChMESG9tZTEU
+MBIGA1UECxMLRGV2ZWxvcG1lbnQxDDAKBgNVBAMTA0FrdTEbMBkGCSqGSIb3DQEJ
+ARYMYWt1QGhvbWUuY29tMB4XDTE0MDExMTAyMDEwOFoXDTQxMDUyODAyMDEwOFow
+ezELMAkGA1UEBhMCVUExDTALBgNVBAgTBEt5aXYxDTALBgNVBAcTBEt5aXYxDTAL
+BgNVBAoTBEhvbWUxFDASBgNVBAsTC0RldmVsb3BtZW50MQwwCgYDVQQDEwNBa3Ux
+GzAZBgkqhkiG9w0BCQEWDGFrdUBob21lLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sA
+MEgCQQDLO4Ou1p+JAJeh+N0ZBxr+0VpEevnfxKNF+X4U3zB0xIvLZF8YJ2eR2Xoe
+XAK64tDIacs8QeCAKFRIUHsEanarAgMBAAEwDQYJKoZIhvcNAQEFBQADQQBP6rxT
+phfoORMjcWHqGyHY3iIzD/nhlH4Kc/cuxfffKllT+kItsr7CoEgIvAEOSjZ/Nnn7
+QRQ8bErNNDbWm3RP
+-----END CERTIFICATE-----
View
9 config/key/key.pem
@@ -0,0 +1,9 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBAMs7g67Wn4kAl6H43RkHGv7RWkR6+d/Eo0X5fhTfMHTEi8tkXxgn
+Z5HZeh5cArri0MhpyzxB4IAoVEhQewRqdqsCAwEAAQJBALOQvRPQ3BqfpFpfWXMQ
+nSCCd0BEa9zzj9N20pi8bsLrhuZw4ucS3V3w+qr4RUw5QbskPW42jAqiChD6ekgq
+QCECIQDqMUv7XKhSkFkwiHEscvCii8SGTWJTPmyHqTjmEmeUUQIhAN4oMDIBOdsF
+Ox9BIqtJ6TKAXftjHrosdrDmx/0g7Mg7AiAspJsUXpRjsMqfutLAI2UFx1j+NRAy
+SCsOLU8AZK/EEQIgXa4sxKlnsEhAaimZaQm94KHo/70IlBFz650l8EQWFUkCIQDT
+uU/B0n7TRWhggivgmrT34d/DBbqRK0b+94ZFkpKuZQ==
+-----END RSA PRIVATE KEY-----
View
10 config/public.json
@@ -2,7 +2,7 @@
"env":{
"production":{
"app":{
- "port": 3000,
+ "port": 443,
"host": "127.0.0.1"
},
"db":{
@@ -11,7 +11,7 @@
},
"development":{
"app":{
- "port": 3000,
+ "port": 443,
"host": "127.0.0.1"
},
"db":{
@@ -20,7 +20,7 @@
},
"test":{
"app":{
- "port": 3000,
+ "port": 443,
"host": "127.0.0.1"
},
"db":{
@@ -35,8 +35,8 @@
"debitoor":{
"authorizationURL": "https://app.debitoor.com/login/oauth2/authorize",
"tokenURL": "https://app.debitoor.com/login/oauth2/access_token",
- "callbackURL": "http://127.0.0.1:3000/",
- "redirectUrl": "http://127.0.0.1:3000/",
+ "callbackURL": "https://127.0.0.1:3000/",
+ "redirectUrl": "https://127.0.0.1:3000/",
"clientID": "real-in-the-private-config",
"clientSecret": "real-in-the-private-config",
"api":{
View
2  log/.gitignore
@@ -1 +1 @@
-'*'
+'*.log'
View
12 server.js
@@ -3,8 +3,9 @@
var async = require('async');
var express = require('express');
-var http = require('http');
+var https = require('https');
var path = require('path');
+var fs = require('fs');
var site = require('./routes/site');
var user = require('./routes/user');
@@ -75,8 +76,13 @@ app.post('/api/v1.0/debitoor/register',
function startServer(cb){
- http.createServer(app).listen(config.app.port, config.app.host, function(){
- var serverUrl = 'http://'+config.app.host+':'+config.app.port;
+ var options = {
+ key: fs.readFileSync('config/key/key.pem'),
+ cert: fs.readFileSync('config/key/cert.pem')
+ };
+
+ https.createServer(options, app).listen(config.app.port, config.app.host, function(){
+ var serverUrl = 'https://'+config.app.host+':'+config.app.port;
log.info('Express server run on: ' + serverUrl);
cb(null, serverUrl);
});
View
3  test/functional.js
@@ -8,6 +8,9 @@
//NODE_ENV must be set before exporting app
process.env.NODE_ENV = 'test';
+//Accept self signed sertificate. Trivial sertificate for testing
+process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
+
var request = require('supertest');
var url = require('url');
var cheerio = require('cheerio');
Please sign in to comment.
Something went wrong with that request. Please try again.