Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

use the correct config key name. Closes #20 #21

Merged
merged 1 commit into from Jul 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/app.js
Expand Up @@ -27,7 +27,7 @@ const issueJWT = () => {
return hook => {
const app = hook.app;
const id = hook.result.id;
return app.passport.createJWT({ userId: id }, app.get('auth')).then(accessToken => {
return app.passport.createJWT({ userId: id }, app.get('authentication')).then(accessToken => {
hook.result.accessToken = accessToken;
return Promise.resolve(hook);
});
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -30,7 +30,7 @@ export default function init (options = {}) {
throw new Error(`Can not find app.passport. Did you initialize feathers-authentication before feathers-authentication-jwt?`);
}

let authOptions = app.get('auth') || {};
let authOptions = app.get('authentication') || {};
let jwtOptions = authOptions[options.name] || {};

// NOTE (EK): Pull from global auth config to support legacy auth for an easier transition.
Expand Down
8 changes: 4 additions & 4 deletions test/index.test.js
Expand Up @@ -47,7 +47,7 @@ describe('feathers-authentication-jwt', () => {
app.use('/users', memory());
app.configure(authentication({ secret: 'supersecret' }));

JWT.sign(Payload, 'supersecret', app.get('auth').jwt, (error, token) => {
JWT.sign(Payload, 'supersecret', app.get('authentication').jwt, (error, token) => {
if (error) { return done(error); }
validToken = token;
done();
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('feathers-authentication-jwt', () => {
sinon.spy(passportJWT, 'Strategy');
app.configure(jwt({ custom: true }));
app.setup();
authOptions = app.get('auth');
authOptions = app.get('authentication');
args = passportJWT.Strategy.getCall(0).args[0];
});

Expand Down Expand Up @@ -179,9 +179,9 @@ describe('feathers-authentication-jwt', () => {

it('pulls options from global config with custom name', () => {
sinon.spy(passportJWT, 'Strategy');
let authOptions = app.get('auth');
let authOptions = app.get('authentication');
authOptions.custom = { entity: 'device' };
app.set('auth', authOptions);
app.set('authentication', authOptions);

app.configure(jwt({ name: 'custom' }));
app.setup();
Expand Down
2 changes: 1 addition & 1 deletion test/integration.test.js
Expand Up @@ -23,7 +23,7 @@ describe('integration', () => {
return hook => {
const app = hook.app;
const id = hook.result.id;
return app.passport.createJWT({ userId: id }, app.get('auth')).then(accessToken => {
return app.passport.createJWT({ userId: id }, app.get('authentication')).then(accessToken => {
hook.result.accessToken = accessToken;
return Promise.resolve(hook);
});
Expand Down
2 changes: 1 addition & 1 deletion test/verifier.test.js
Expand Up @@ -27,7 +27,7 @@ describe('Verifier', () => {
app.use('users', service)
.configure(authentication({ secret: 'supersecret' }));

options = app.get('auth');
options = app.get('authentication');
verifier = new Verifier(app, options);
});

Expand Down