Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Removing the cookie authentication fallback. Refs #132.
Browse files Browse the repository at this point in the history
  • Loading branch information
ekryski committed Mar 28, 2016
1 parent 72891cc commit 2e35da0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
8 changes: 2 additions & 6 deletions src/middleware/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@ export let normalizeAuthToken = function(options = {}) {
}
}

// If we don't already have token in the header check for a cookie
if (!token && req.cookies && req.cookies[options.cookie]) {
token = req.cookies[options.cookie];
}
// Check the body next if we still don't have a token
else if (req.body.token) {
if (req.body.token) {
token = req.body.token;
delete req.body.token;
}
// Finally, check the query string. (worst method)
// Finally, check the query string. (worst method but nice for quick local dev)
else if (req.query.token) {
token = req.query.token;
delete req.query.token;
Expand Down
26 changes: 0 additions & 26 deletions test/src/middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,6 @@ describe('Middleware', () => {
});
});

describe('Auth token passed via cookie', () => {
it('grabs the token', () => {
const req = Object.assign({}, MockRequest, {
cookies: {
'feathers-jwt': 'my-token'
}
});

middleware.normalizeAuthToken(options)(req, MockResponse, MockNext);
expect(req.feathers.token).to.deep.equal('my-token');
});

it('supports a custom cookie', () => {
const req = Object.assign({}, MockRequest, {
cookies: {
'my-cookie': 'my-token'
}
});

const newOptions = Object.assign({}, options, {cookie: 'my-cookie'});

middleware.normalizeAuthToken(newOptions)(req, MockResponse, MockNext);
expect(req.feathers.token).to.deep.equal('my-token');
});
});

describe('Auth token passed via body', () => {
it('grabs the token', () => {
const req = Object.assign({}, MockRequest, {
Expand Down

0 comments on commit 2e35da0

Please sign in to comment.