-
Notifications
You must be signed in to change notification settings - Fork 194
Assignment6 #152
Assignment6 #152
Changes from all commits
0a72d34
4898f28
b491828
e402827
fb3360f
ad233d9
1dfa7f2
53584e6
bc19ef3
37de149
3a086ce
ca2caf8
907308a
0722be9
f967d93
c4353ff
8a91385
1b141eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ config.json | |
*/._* | ||
*/*/._* | ||
coverage.* | ||
*/*~ | ||
.emacs* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
document.onreadystatechange = function () { | ||
|
||
if (document.readyState === 'complete') { | ||
|
||
document.getElementById('btnLogin').addEventListener('click', function (event) { | ||
|
||
event.preventDefault(); | ||
console.log('Login Button Clicked'); | ||
}); | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
h3 { | ||
font-size: 24px; | ||
font-weight: bold; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICRzCCAbACCQDLKLdg5Wbn9TANBgkqhkiG9w0BAQsFADBoMQswCQYDVQQGEwJB | ||
VTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 | ||
cyBQdHkgTHRkMSEwHwYJKoZIhvcNAQkBFhJydXRhaWh3YUBnbWFpbC5jb20wHhcN | ||
MTUwNjA4MTE1MjU1WhcNMTYwNjA3MTE1MjU1WjBoMQswCQYDVQQGEwJBVTETMBEG | ||
A1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkg | ||
THRkMSEwHwYJKoZIhvcNAQkBFhJydXRhaWh3YUBnbWFpbC5jb20wgZ8wDQYJKoZI | ||
hvcNAQEBBQADgY0AMIGJAoGBANIDuMQini8ttfexVQdmph6hjKXxVc1Zk8bX6z0O | ||
b9uKw4SrHXDKYelgmvG9Gv8awl8hElbUamVNWe5U7sN3LxiTzTMu+rhScABzrt6X | ||
VZEJxZsdFYgIzvzC6PUy1rBMb7MZGmdm5Cd5eaWAGQ/lPfI+dW604FKVo/xI5gPd | ||
8lWbAgMBAAEwDQYJKoZIhvcNAQELBQADgYEArZPt5dJXnGQxWTt0FsGF9Mk6IsfJ | ||
4sTS2vt9KND2i18RT0qyn3YUsqfnjieRKId5Ru2PYsqJEFz2/e0OwmAxjmrpiz2q | ||
9yfTHFtWB3Rjt/O+IXN9D4otwb6ADrzkXDy1FWwPMDK9vJ3A/quBhN8iCpcr+FdH | ||
MMbrPytUAKCaSLs= | ||
-----END CERTIFICATE----- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIICXQIBAAKBgQDSA7jEIp4vLbX3sVUHZqYeoYyl8VXNWZPG1+s9Dm/bisOEqx1w | ||
ymHpYJrxvRr/GsJfIRJW1GplTVnuVO7Ddy8Yk80zLvq4UnAAc67el1WRCcWbHRWI | ||
CM78wuj1MtawTG+zGRpnZuQneXmlgBkP5T3yPnVutOBSlaP8SOYD3fJVmwIDAQAB | ||
AoGARPLL2jizTjHnp+YkUEW3DB9lmaVd0gkypvmEVYtD1gP8pLW4+Kq48nGw7OR0 | ||
1IPohGrLJo6eT5vRhpmDudCLOSIYPVqi/14kW+ahMJuMc2FGohRL89dIGEWvGPks | ||
2c4YCtYhZL4sfFJwE2TVnOv8jmQM8l0Y/K/vXcLPrNFzfmECQQDvmo5mEYsVrV9/ | ||
UFCEi7b38e2tLdo40U6eRm9yd6zK7XpYqQVMGJFB14EU4FSyUMk9lpvAiHJjFCG2 | ||
alkR6mtnAkEA4GLQWGXkjNBn/5aUlbPsqGKzWfDQqMaGnsPCDEJsONAemPxqDsmO | ||
5qBP3CWH093azT2NTWWDefM07KdciqKXrQJBANjzfE6lQeet5VN1GIL7sv+M2qW9 | ||
Z+OcefBMXKsr+5R/NRHEcVx2vkf85w9NFMOk7KLMlVje85wM5X2zi9TyCq8CQQC7 | ||
K1HVWvEhULpfZbD9iv8Omn42uPykvC0RBAO6jDGP1nKfdHXXbePolrLm1NuPLBFW | ||
gFB8zf+02t07xoMYFXZlAkA5YaolWVD/IMb1H8UYh2enseR5IFVrrkbOAnTSHXzX | ||
w1w+wU4rNow/hftjSuW7nnOozWYwI+HEmgvsf9P6Wnke | ||
-----END RSA PRIVATE KEY----- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var Fs = require('fs'); | ||
|
||
var config = module.exports = {}; | ||
|
||
// Configuring TLS | ||
config.tls = { | ||
key: Fs.readFileSync('./lib/certs/key.key'), | ||
cert: Fs.readFileSync('./lib/certs/cert.crt'), | ||
|
||
// Only necessary if using the client certificate authentication. | ||
requestCert: true, | ||
|
||
// Only necessary only if client is using the self-signed certificate. | ||
ca: [] | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ var Code = require('code'); | |
var Lab = require('lab'); | ||
var University = require('../lib'); | ||
var Path = require('path'); | ||
var Config = require('../lib/config'); | ||
|
||
// Declare internals | ||
|
||
|
@@ -19,17 +20,33 @@ var it = lab.test; | |
|
||
describe('/home', function () { | ||
|
||
it('returns home page containing relative path from root to home template', function (done) { | ||
it('ensures that /home is always redirected to https', function (done) { | ||
|
||
University.init(internals.manifest, internals.composeOptions, function (err, server) { | ||
|
||
expect(err).to.not.exist(); | ||
|
||
var request = { method: 'GET', url: '/home' }; | ||
server.inject(request, function (res) { | ||
server.select('web').inject(request, function (res) { | ||
|
||
expect(res.statusCode, 'Status code').to.equal(301); | ||
expect(res.headers.location).to.equal('https://localhost:8001/home'); | ||
|
||
server.stop(done); | ||
}); | ||
}); | ||
}); | ||
|
||
it('returns an home page via https', function (done) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is the actual test for testing if it indeed is served via https? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AdriVanHoudt What you mean to this test below or the above one? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Headers location shows it was redirected to https, proving it was redirected to https. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. below, i see you did in other tests although if you change the port your test fails even when routing to https which seems weird but also will probably never happen ^^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AdriVanHoudt How would you test it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rutaihwa turns out it's not really available, because of the redirect the protocol in the connection info is http (somewhere deep in the res object ;)) so the better thing would be to do |
||
|
||
University.init(internals.manifest, internals.composeOptions, function (err, server) { | ||
|
||
expect(err).to.not.exist(); | ||
|
||
var request = { method: 'GET', url: '/home' }; | ||
server.select('web-tls').inject(request, function (res) { | ||
|
||
expect(res.statusCode, 'Status code').to.equal(200); | ||
expect(res.result, 'result').to.equal(Path.relative(Path.resolve('__dirname', '../'), Path.resolve('__dirname', '../views/home.html'))); | ||
|
||
server.stop(done); | ||
}); | ||
|
@@ -40,7 +57,15 @@ describe('/home', function () { | |
internals.manifest = { | ||
connections: [ | ||
{ | ||
port: 0 | ||
host: 'localhost', | ||
port: 0, | ||
labels: ['web'] | ||
}, | ||
{ | ||
host: 'localhost', | ||
port: 0, | ||
labels: ['web-tls'], | ||
tls: Config.tls | ||
} | ||
], | ||
plugins: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why register the plugins also on web when all routes are redirected to web-tls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AdriVanHoudt, I think you are right 👍 , since everything gets caught and redirected to
https
before being routed, it may be not necessary to registerweb
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unnecessary at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, will be addressed in the next commit.