-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow filtering the PHP classname used for a provider (#546)
* Add a method to providers to specify the provider slug, separately from the class name. * Refer to it as a Provider Name rather than Provider Class. * Move get_instance() from individual classes to the abstract base, to allow individual classes to be extended. * Add unit tests for the filter, and that replacing a provider with another works. * Add unit tests for Two_Factor_Provider::get_instance().
- Loading branch information
Showing
10 changed files
with
192 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* Class for creating a dummy provider that never passes. | ||
* | ||
* This is a mock for unit testing the provider class name filter, and where authentication should never pass. | ||
* | ||
* @package Two_Factor | ||
*/ | ||
class Two_Factor_Dummy_Secure extends Two_Factor_Dummy { | ||
|
||
/** | ||
* Pretend to be the Two_Factor_Dummy provider. | ||
*/ | ||
public function get_key() { | ||
return 'Two_Factor_Dummy'; | ||
} | ||
|
||
/** | ||
* Validates the users input token. | ||
* | ||
* In this class we just return false. | ||
* | ||
* @param WP_User $user WP_User object of the logged-in user. | ||
* @return boolean | ||
*/ | ||
public function validate_authentication( $user ) { | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.