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 LDAPS-support to LDAP-Authcontroller #7014

Merged
merged 3 commits into from
Nov 19, 2020

Conversation

fastrde
Copy link
Contributor

@fastrde fastrde commented Nov 17, 2020

I added LDAPS Support to the LDAP-Authcontroller, because plain LDAP is not my first choice when it comes to authentication ;)
The certificates are for testing purposes only and expires in 100 years.

@codecov
Copy link

codecov bot commented Nov 17, 2020

Codecov Report

Merging #7014 (20e9672) into master (ccb045b) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7014      +/-   ##
==========================================
- Coverage   93.81%   93.80%   -0.02%     
==========================================
  Files         169      169              
  Lines       12407    12415       +8     
==========================================
+ Hits        11640    11646       +6     
- Misses        767      769       +2     
Impacted Files Coverage Δ
src/Adapters/Auth/ldap.js 93.87% <100.00%> (+1.19%) ⬆️
src/Adapters/Files/GridFSBucketAdapter.js 79.50% <0.00%> (-0.82%) ⬇️
src/RestWrite.js 93.51% <0.00%> (-0.17%) ⬇️

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 ccb045b...20e9672. Read the comment docs.

'LDAP: Wrong username or password'
)
);
let error;
Copy link
Member

Choose a reason for hiding this comment

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

NIT: Could you please move this line to inside the if currently in line 27?

Copy link
Contributor Author

@fastrde fastrde Nov 17, 2020

Choose a reason for hiding this comment

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

can't move it in the if clause. the if clause (inside the bind callback) is executed twice when the cert mismatch happens. first time the mismatch error is detected, second time the client destruction destroyes the correct error message. error has to be outside to stay set to the first mismatch error after the second client destroy error happened.

Copy link
Member

Choose a reason for hiding this comment

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

It does not make sense. The var is not used outside the scope and inside the scope it is only assigned and then used to reject the promise. You can also do the following just to make sure:

reject(error);
client.destroy(ldapError);
return;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. The return reject (error) was the part that confuses the execution flow. With the rejection and the return splitted I could also remove the case undefined.

Copy link
Member

@davimacedo davimacedo left a comment

Choose a reason for hiding this comment

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

Could you please just add one more test which should fail with right certificate and wrong credentials?

@fastrde fastrde requested a review from davimacedo November 17, 2020 20:48
Copy link
Member

@davimacedo davimacedo left a comment

Choose a reason for hiding this comment

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

LGTM!

@davimacedo davimacedo merged commit c958c46 into parse-community:master Nov 19, 2020
@fastrde fastrde deleted the ldaps branch November 19, 2020 01:04
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.

2 participants