Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin whitelist #650

Closed
wants to merge 6 commits into from
Closed

Plugin whitelist #650

wants to merge 6 commits into from

Conversation

pedro-rosario
Copy link
Contributor

@pedro-rosario pedro-rosario commented Apr 9, 2019

Whitelist to skip plugin auth

Plugins can also be objects now so they can pass metadata to amphora like a routes whitelist.

...
plugins: [
  ...,
  amphoraSearchPlugin,
  { init: testPluginFunction, whitelist: ['/_test-route'] };
],
...

This allows amphora to know which routes should skip the authentication

TODO

Closes #640

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2199

  • 42 of 42 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 2184: 0.0%
Covered Lines: 4518
Relevant Lines: 4518

💛 - Coveralls

});
});
});

describe('getWhitelistFromPlugins', function () {
it('returns an array of all the plugin\'s whitelist combined', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we cache the function that's being tested so we don't have to call lib.getWhitelistFromPlugins in every test case?

describe('getWhitelistFromPlugins', function () {
  const fn = lib[this.title];

  it('returns an array of all the plugin\'s whitelist combined', function () {
    // ...

    expect(fn(plugins)).to.eql(['/_test']);
  });
});

Do this for every test suite

});

describe('skipAuth', function () {
it('sets skipAuth to true if the request url is in the whitelist', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same suggestion as before

@pedro-rosario
Copy link
Contributor Author

Closing this since the approach is not what we are interested in at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Amphora Plugins Auth Requirement
3 participants