Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Related to issue #6, adding the bootstrap glyphicons to fix the redir…
Browse files Browse the repository at this point in the history
…ect issue and to make them available.
  • Loading branch information
tizzo committed Feb 12, 2014
1 parent 10e2c93 commit ed100ba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ function inURLWhiteList(url) {
'/mockAuth',
'/auth/google',
'/oauth2callback',
'/css/bootstrap.css'
'/css/bootstrap.css',
'/img/glyphicons-halflings.png'
];
var url = url.split('?')[0];
return whiteList.indexOf(url) !== -1;
Expand All @@ -219,7 +220,7 @@ function ensureAuthenticated(req, res, next) {
// We don't want to redirect people to the favicon.
// If it's not a favicon, save the original destination
// in the session.
if (req.url.match('favicon.ico') == null && req.session) {
if (req.url.match('favicon.ico') == null && !inURLWhiteList(req.url) && req.session) {
req.session.redirectTo = req.url;
}
var redirectDest = 'https://' + config.host + ':' + config.port + config.loginPath;
Expand Down
Binary file added public/img/glyphicons-halflings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Server', function(){
done(error);
});
});
it('should server css assets if not authenticated', function(done) {
it('should serve css assets if not authenticated', function(done) {
var options = {
uri: 'https://127.0.0.1:' + ports[0] + '/css/bootstrap.css',
followRedirect: false,
Expand All @@ -92,6 +92,23 @@ describe('Server', function(){
done(error);
});
});
it('should serve image assets if not authenticated', function(done) {
var options = {
uri: 'https://127.0.0.1:' + ports[0] + '/img/glyphicons-halflings.png',
followRedirect: false,
strictSSL: false,
rejectUnauthorized : false,
// Empty out the cookie jar to ensure we don't accidentally auth if these tests run twice.
jar: new request.jar()
};
request(options, function(error, response, body) {
if (error) {
done(error);
}
response.statusCode.should.equal(200);
done(error);
});
});
it ('should allow proxying to an annonymous user for a public route.', function(done) {
app.config.routes = [
{
Expand Down

0 comments on commit ed100ba

Please sign in to comment.