-
Notifications
You must be signed in to change notification settings - Fork 121
Handle deletion of app password when authenticated with WPCom #16046
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
Handle deletion of app password when authenticated with WPCom #16046
Conversation
|
|
|
|
||
| /// Verifies that application password is deleted upon calling `deleteApplicationPassword` | ||
| /// | ||
| func test_deleteApplicationPassword_deletes_password_from_keychain() { |
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.
These tests are removed as they are incorrect. Unit tests should only test immediate functionalities.
RafaelKayumov
left a comment
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.
LGTM.
WP.com authorized accounts switching produced a new password after login on site B and deleted the password on site A. Store credentials login produced a new application password. Logging out caused the password deletion.
Just left a couple of non-blocking comments.
|
|
||
| /// Keeps strong reference of the use case to keep the password deletion request alive | ||
| /// periphery: ignore | ||
| var applicationPasswordUseCase: ApplicationPasswordUseCase? |
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.
NIT: Will the applicationPasswordUseCase instance live until the next deleteApplicationPassword(using creds: Credentials?, locally: Bool) is called? Should we clean that up after async task is completed?
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 added in f302200.
| /// Nukes all of the known Session's properties. | ||
| /// | ||
| func reset() { | ||
| deleteApplicationPassword() |
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'm still not fluent with the application passwords states and logic. So the question: what's the reason for removing the password deletion on reset call?
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.
Was the deleteApplicationPassword(locally: true) just moved outside of the reset?
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.
Yes just moved outside for separation of concern. The method is not called anywhere else other than DefaultStoresManager.

Close WOOMOB-1177
Description
This PR adds the support for cleaning up application password when user is authenticated with WPCom. The idea to delete passwords in two places:
Apologies for the large changes, most of them come from unit tests. Specifically:
ApplicationPasswordUseCaseto support deleting password remotely only.SessionManagertoDefaultStoresManagerfor separation of concern and easier testing.SessionManagerto support delete password when authenticated with WPCom.DefaultStoresManagerto trigger delete password remotely only for switching sites (inremoveDefaultStore) and locally upon logout (indeauthenticate).ApplicationPasswordNameAndUUIDMapperto support parsing app password from Jetpack-proxied response withdataenvelope.Testing steps
WPCom authentication
Site credentials / app password login
Testing information
Screenshots
No UI changes.
RELEASE-NOTES.txtif necessary.