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

Add support to secured endpoints throught Authorization header #358

Merged
merged 8 commits into from
Mar 15, 2019

Conversation

sebasjm
Copy link
Contributor

@sebasjm sebasjm commented Oct 12, 2016

This is a change I made to allow communication with a server that require authorization.

@andrewimm
Copy link
Contributor

Thanks for the PR.

I have to requests: first, credentials isn't clear what it refers to. I'd want to use something along the lines of "bearer token" or "server auth token."

It will probably be decided by the second question I have: what is the best way to include http basicauth as well? We want to be able to specify both an auth type and an auth token.

Taking all of that into account, I'd ask that this be extended into two fields: serverAuthType and serverAuthToken (in CoreManager, SERVER_AUTH_TYPE and SERVER_AUTH_TOKEN).

Then, change the logic in the REST controller to

if (CoreManager.get('SERVER_AUTH_TYPE') && CoreManager.get('SERVER_AUTH_TOKEN') {
  headers['Authorization'] = CoreManager.get('SERVER_AUTH_TYPE') + ' ' + CoreManager.get('SERVER_AUTH_TOKEN');
}

@codecov
Copy link

codecov bot commented Jun 18, 2017

Codecov Report

Merging #358 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #358      +/-   ##
==========================================
- Coverage   84.35%   84.32%   -0.04%     
==========================================
  Files          46       46              
  Lines        3663     3668       +5     
  Branches      835      836       +1     
==========================================
+ Hits         3090     3093       +3     
- Misses        573      575       +2
Impacted Files Coverage Δ
src/CoreManager.js 100% <ø> (ø) ⬆️
src/RESTController.js 83.06% <ø> (+0.27%) ⬆️
src/Parse.js 79.41% <ø> (-2.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2956dec...fe228b9. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 18, 2017

Codecov Report

Merging #358 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #358      +/-   ##
==========================================
+ Coverage   88.83%   88.85%   +0.01%     
==========================================
  Files          53       53              
  Lines        4620     4628       +8     
  Branches     1069     1070       +1     
==========================================
+ Hits         4104     4112       +8     
  Misses        516      516
Impacted Files Coverage Δ
src/CoreManager.js 100% <ø> (ø) ⬆️
src/Parse.js 85.71% <100%> (+1.09%) ⬆️
src/RESTController.js 80.98% <100%> (+0.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1257623...76e64a3. Read the comment docs.

@dplewis dplewis merged commit 6708261 into parse-community:master Mar 15, 2019
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.

None yet

6 participants