Skip to content

Commit

Permalink
fix: Always require strategy parameter in authentication (feathersjs#…
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed May 4, 2019
1 parent f360dc8 commit 8781186
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
5 changes: 0 additions & 5 deletions src/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AuthenticationRequest, AuthenticationBaseStrategy
} from '@feathersjs/authentication';
import { Params } from '@feathersjs/feathers';
import { NotAuthenticated } from '@feathersjs/errors';

const debug = Debug('@feathersjs/authentication-oauth/strategy');

Expand Down Expand Up @@ -97,10 +96,6 @@ export class OAuthStrategy extends AuthenticationBaseStrategy {
}

async authenticate (authentication: AuthenticationRequest, params: Params) {
if (authentication.strategy !== this.name) {
throw new NotAuthenticated('Not authenticated');
}

const entity: string = this.configuration.entity;
const profile = await this.getProfile(authentication, params);
const existingEntity = await this.findEntity(profile, params)
Expand Down
12 changes: 0 additions & 12 deletions test/strategy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ describe('@feathersjs/authentication-oauth/strategy', () => {
});

describe('authenticate', () => {
it('errors when strategy is not set', async () => {
try {
await strategy.authenticate({
id: 'newEntity'
}, {});
assert.fail('Should never get here');
} catch (error) {
assert.equal(error.name, 'NotAuthenticated');
assert.equal(error.message, 'Not authenticated');
}
});

it('with new user', async () => {
const authResult = await strategy.authenticate({
strategy: 'test',
Expand Down

0 comments on commit 8781186

Please sign in to comment.