You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use Case: ability to disable that Access Tokens are accepted when in an URL #1326
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)
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.
@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.
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.
@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.
Activity
bajtos commentedon Apr 28, 2015
This should be relatively easy to implement as a new configuration option for
loopback#tokenmiddleware. The options are processed in common/models/access-token.js.crandmck commentedon Apr 30, 2015
@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.
crandmck commentedon May 1, 2015
ty!
bajtos commentedon May 4, 2015
Reopening, this GH issue is tracking a feature request, not a doc update. See also #1347
crandmck commentedon May 4, 2015
Oops, sorry!
OwenBrotherwood commentedon May 25, 2015
@bajtos option is available.
You should be able to merge it https://github.com/strongloop/loopback/compare/master...sloopback:loopback-issue-1326?expand=1
downstream issue: https://github.com/sloopback/sloopback-issues/issues/4
bajtos commentedon May 26, 2015
@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.
OwenBrotherwood commentedon May 26, 2015
@bajtos I understand.
Please state if the tests are ok for a pull request, the actual implementation code is very little.
bajtos commentedon May 28, 2015
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:
OwenBrotherwood commentedon May 28, 2015
@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.
bajtos commentedon May 28, 2015
I see, that's unfortunate. Can you please list the issues in the test, perhaps somebody else will be willing to fix them?