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

OpenID #149

Closed
wants to merge 18 commits into from
Closed

OpenID #149

wants to merge 18 commits into from

Conversation

idiidk
Copy link
Collaborator

@idiidk idiidk commented Aug 31, 2019

Switch to my magister-openid package to support proper OpenID authentication and token management.

Where you could locally store the token variable, (that would expire after an hour xd), you should now save the tokenSet. This is an object containing the access and refresh tokens. You can initialize MagisterJS with this token set, tokens are automatically checked and refreshed if necessary. This negates the saving of plaintext passwords!

My package is a wrapper around the openid-client library. It just adds support for Magister.
I think it's a lot more maintainable and clean to keep the authentication code and main library code separate. So that's why I created the package.

All tests pass on my end, and the code is linted to spec.

CREDIT TO @Sj3rd FOR HELPING ME FIGURE THIS OUT, COULDN'T HAVE DONE IT WITHOUT HIM (en z'n papa is pliesie dus deze credit moet wel)

x idiidk

@idiidk idiidk added this to the 2.0 stable milestone Aug 31, 2019
@idiidk idiidk requested a review from lieuwex August 31, 2019 17:44
@idiidk
Copy link
Collaborator Author

idiidk commented Aug 31, 2019

Ly @netlob

@netlob
Copy link
Contributor

netlob commented Aug 31, 2019

Ly2bb @idiidka

@idiidk
Copy link
Collaborator Author

idiidk commented Aug 31, 2019

This will also fix #100 and #91

@idiidk idiidk requested review from jvdoorn and tomsmeding September 1, 2019 08:16
@lieuwex
Copy link
Member

lieuwex commented Sep 3, 2019

Super nice!

I totally ship you guys too.

test/test.js Outdated Show resolved Hide resolved
jvdoorn
jvdoorn previously approved these changes Sep 3, 2019
Copy link
Contributor

@jvdoorn jvdoorn left a comment

Choose a reason for hiding this comment

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

I agree that it is cleaner to keep authentication in a separate repository. I didn't test if everything works, but if you say that your tests all pass I think it's fine. It looks good to me!

@@ -72,13 +71,15 @@ class Http {
* @param {Object} obj
* @returns {Request}
*/
makeRequest(obj) {
async makeRequest(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this (the function now being async) create any issues?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, I fixed all the refrences

const init = {
method: obj.method,
timeout: this._requestTimeout,
headers: {
...obj.headers,
Authorization: 'Bearer ' + this._token,
Authorization: `Bearer ${accessToken}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Much cleaner.

lieuwex
lieuwex previously approved these changes Sep 3, 2019
@idiidk idiidk removed the request for review from tomsmeding September 3, 2019 14:50
@idiidk idiidk dismissed stale reviews from lieuwex and jvdoorn via e8b9aa9 September 3, 2019 15:27
@idiidk
Copy link
Collaborator Author

idiidk commented Sep 3, 2019

Okay, the login function now throws AuthErrors and the tests are updated to support that! Hopefully that`s enough for a merge ;)

@idiidk idiidk requested review from lieuwex and jvdoorn September 3, 2019 15:33
@LevitatingBusinessMan
Copy link
Contributor

I love this!

@netlob
Copy link
Contributor

netlob commented Sep 3, 2019

Great to hear all this work wasn't for nothing! :)

@lieuwex
Copy link
Member

lieuwex commented Sep 3, 2019

Rebased on top of master with some squashes!
Thank you very much :)

@lieuwex lieuwex closed this Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants