Skip to content

Use Case: ability to disable that Access Tokens are accepted when in an URL #1326

Closed

Description

@OwenBrotherwood

Use Case:

  • ability to disable that Access Tokens are accepted when in an URL
  • alternativly, possibility to enforce elsewhere as an alternative

It may be such that it is not possible to disable the use of Access Tokens when sent in an URL.
As to if one can enforce in a model is unknown.

Addresses a case if the use of URL (or cookie) based Access Tokens are not allowed.


Implementation for options.searchDefaultTokenKeys


$ mocha -g 'api.*token'

  api:loopback:middleware:token(options)
    loopback.token({})
      V header (125ms)
      Breaking change
        V None
    options
      searchDefaultTokenKeys:[true|false]
        Normal usage: false for use case, restrict location of token
          Example, token in header
            V options.headers is empty, true (46ms)
            V options.headers has header, false
        Unormal usage: testing or unknown usage
          Example, token in header
searchDefaultTokenKeys is false and no headers: no token keys will be found
            V options.headers is empty, false
        Breaking change
          V None

  6 passing (297ms)

Compare master

https://github.com/strongloop/loopback/compare/master...sloopback:loopback-issue-1326?expand=1

Activity

  1. bajtos commented on Apr 28, 2015

    @bajtos
    Member

    This should be relatively easy to implement as a new configuration option for loopback#token middleware. The options are processed in common/models/access-token.js.

  2. crandmck commented on Apr 30, 2015

    @crandmck
    Contributor

    @OwenBrotherwood Yes, we only allow editing of articles in the LoopBack (LB) space.

    I added a note about the above issue: http://docs.strongloop.com/display/SL/Installation+troubleshooting#Installationtroubleshooting-Firewallissues
    Have a look and let me know if I got it right--thanks.

  3. crandmck commented on May 1, 2015

    @crandmck
    Contributor

    ty!

  4. reopened this on May 4, 2015
  5. bajtos commented on May 4, 2015

    @bajtos
    Member

    Reopening, this GH issue is tracking a feature request, not a doc update. See also #1347

  6. crandmck commented on May 4, 2015

    @crandmck
    Contributor

    Oops, sorry!

  7. OwenBrotherwood commented on May 25, 2015

    @OwenBrotherwood
    ContributorAuthor
  8. bajtos commented on May 26, 2015

    @bajtos
    Member

    @OwenBrotherwood please submit a regular pull request against the loopback repository (strongloop/loopback). Include unit-tests covering your changes, keep these unit-tests consistent with the style of existing tests we have in LoopBack now. This is the easiest way for me to review your changes and land them in LoopBack master.

    I appreciate the effort you are making to start contributing to LoopBack and I hope you will continue to do so :)

    If I may offer you a piece of general advice: when starting to contribute to a new project, please begin with small fixes/features (like the one described in this issue) and keep the amount of changes as small as possible, always honour the coding and testing style that the project currently uses. More often than not, there are reasons why the project has decided on the current rules, even though these reasons are not immediately obvious to new contributors. By playing by the project rules, you show respect to the maintainers and the decisions they have made in the past. As a result, you make it easier for the maintainers to trust & respect your opinions in return.

    I know it's not easy, I went through this pain myself when I started contributing to Node core and other existing projects in the npm ecosystem. I took me quite some time to realise that many times it's better to contribute a patch that I consider imperfect, rather than to try to convince project maintainers that they should be doing things in a different way. That's at least my experience.

  9. OwenBrotherwood commented on May 26, 2015

    @OwenBrotherwood
    ContributorAuthor

    @bajtos I understand.
    Please state if the tests are ok for a pull request, the actual implementation code is very little.

  10. bajtos commented on May 28, 2015

    @bajtos
    Member

    Please state if the tests are ok for a pull request, the actual implementation code is very little.

    Please rework the tests to be consistent with the current test suite in test/access-token.test.js. Your original PR #1347 started in the right direction, probably up to c20cefd.

    I agree the actual implementation code is very little, but we still need a test suite:

    • to verify that the changes work as intended and
    • to ensure the code will stay working this way in the future too.
  11. OwenBrotherwood commented on May 28, 2015

    @OwenBrotherwood
    ContributorAuthor

    @bajtos I am afraid the access-token.test.js has several issues, and if I was to add something in it, I would have to address these. I do not have this time.

  12. bajtos commented on May 28, 2015

    @bajtos
    Member

    I am afraid the access-token.test.js has several issues, and if I was to add something in it, I would have to address these. I do not have this time.

    I see, that's unfortunate. Can you please list the issues in the test, perhaps somebody else will be willing to fix them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions