-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat: implemented native authentication with pwa using auth0 API #343
Conversation
Features
Bug FixesContributorsCommit-Lint commandsYou can trigger Commit-Lint actions by commenting on this PR:
|
Hello @vickywane! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-05-20 11:00:22 UTC |
This pull request introduces 8 alerts when merging 911e583 into 440cebc - view on LGTM.com new alerts:
|
@vickywane the CI checks are failing. Let me know when all checks pass. I would also like to review simultaneously the UI PR that handles user authorization approval for this edge device. |
This pull request introduces 3 alerts when merging 18c263b into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging e5e770d into 440cebc - view on LGTM.com new alerts:
|
Codecov Report
@@ Coverage Diff @@
## master #343 +/- ##
==========================================
+ Coverage 94.56% 94.61% +0.04%
==========================================
Files 23 23
Lines 2228 2264 +36
==========================================
+ Hits 2107 2142 +35
- Misses 121 122 +1
|
This pull request introduces 4 alerts when merging 44b96e6 into 440cebc - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vickywane the codecov check does not pass. This PR doesn't have a single test to cover the new code.
See other comments inline.
This pull request introduces 5 alerts when merging 6c4595d into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 5 alerts when merging 5163e0c into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging c1fd0cf into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 5 alerts when merging 091b2cb into 440cebc - view on LGTM.com new alerts:
|
@vickywane |
Seems to be an issue with Draw. I just duplicated the diagram in a new document here |
|
I am currently writing tests for the new API endpoints introduced as part of the edge-PWA auth flow. The first endpoint ( However, there's seems to be a limit to what can be tested. The This also affects the third endpoint ( |
This pull request introduces 5 alerts when merging 4196bf8 into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging 33b5231 into 440cebc - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am currently writing tests for the new API endpoints introduced as part of the edge-PWA auth flow.
The first endpoint (
/user-code
)has been covered with tests.However, there's seems to be a limit to what can be tested. The
/verify-token
route returns a URL to a page containing a button that has to be manually clicked by a user before the authentication is complete. This cannot be done within the test suite except using simulation tests.This also affects the third endpoint (
/save-token
). The authentication has be complete before a valid token is returned by auth0.
Unit tests should not depend on third party services. Isolate and test your own code.
Worry about integration tests after you have full unit test coverage.
src/ambianic/webapp/flaskr.py
Outdated
|
||
return response | ||
|
||
@app.route('/api/auth/save-token', methods=['POST']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this new code needs to be covered with unit tests.
@vickywane read a bit more how to create proper activity design diagrams. You have options, but whichever one you pick must communicate clearly who and when does what exactly: |
Thank you. I just expanded the document following guides from the articles above. The updated image is in the PR description above. |
The link in the PR description text points to an outdated document. Make sure the view and the link are in sync. Even better, make the PNG clickable and linking directly to the latest diagram source so it's easy to collaborate on it. |
The link has been fixed. It was becoming large so I had to use another means to export. |
This pull request introduces 5 alerts when merging 2ff1b12 into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging fa2ad11 into 440cebc - view on LGTM.com new alerts:
|
The link now points to a google doc, that does not allow comments.... |
I have updated the file permission here. |
OK, I can comment now. |
This pull request introduces 1 alert when merging ec392a3 into 440cebc - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still a few open comment that are awaiting response
This pull request introduces 4 alerts when merging 7c4ddf1 into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging aecd2f4 into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging 054679e into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 4 alerts when merging e344c43 into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 67174b3 into 440cebc - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging f6a0d0c into 440cebc - view on LGTM.com new alerts:
|
I think I have responded and made adjustments to all raised comments. |
@vickywane please address these linting issues. |
@vickywane use mockups to emulate server side behavior. https://changhsinlee.com/pytest-mock/ |
This is an old and outdated comment. It was part of the previous implementation which has been discarded. We no longer have those routes / endpoints in the codebase. |
This pull request introduces 1 alert when merging 1e4b19f into e7e963d - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 0425a66 into e7e963d - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 9704d71 into e7e963d - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging a3c6b97 into 0291b2a - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 704b1b1 into 0291b2a - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 2fb55f8 into 0291b2a - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging baed1d8 into 0291b2a - view on LGTM.com new alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanup redundant notification code and address unresolved comments.
As requested I have created the following issues to be immediately worked upon after this pull request is merged;
The following were created in the Cloud API repository as they would be implemented there; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vickywane looks good. merging.
# [1.15.0](v1.14.7...v1.15.0) (2021-06-08) ### Bug Fixes * fixed auth0 client ([bccf6d8](bccf6d8)) * undefined build errors ([f1d0aa2](f1d0aa2)) ### Features * added new auth endpoint ([2199ca3](2199ca3)) * implemented native authentication with pwa using auth0 API ([d82d998](d82d998)), closes [#343](#343)
🎉 This PR is included in version 1.15.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [1.12.0](v1.11.1...v1.12.0) (2021-06-24) ### Bug Fixes * fixed auth0 client ([bccf6d8](bccf6d8)) * undefined build errors ([f1d0aa2](f1d0aa2)) ### Features * added new auth endpoint ([2199ca3](2199ca3)) * implemented native authentication with pwa using auth0 API ([d82d998](d82d998)), closes [ambianic#343](https://github.com/ivelin/ambianic-edge/issues/343)
Purpose
This PR implements a native authentication with a user's PWA, as a requirement for the premium user feature
Approach
Work done here fetches the user's access_token from auth0 after the user's consent from the PWA.
This design diagram shows how the notification feature is being implemented in this Pull Request and also how it integrates with the connected PWA.
Merge Checklist