forked from matomo-org/matomo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App specific token_auths (matomo-org#15410)
* some initial work * add security page * backing up some code * more functionality * adjust more UI parts * adjust more code * more tweaks * add todo note * few tweaks * make sure date is in right format * fix not existing column * few fixes * available hashes * use different hash algo so tests run on php 5 * fix name of aglorithm * trying to fix some tests * another try to fix some tests * more fixes * more fixes * few fixes * update template * fix some tests * fix test * fixing some tests * various test fixes * more fixes * few more tests * more tests * various tweaks * add translations * add some ui tests * fix selector * tweaks * trying to fix some ui tests * fallback to regular authentication if needed * fix call authenticate on null * fix user settings * fix some tests * few fixes * fix more ui tests * update schema * Update plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js Co-Authored-By: Stefan Giehl <[email protected]> * fix maps are not showing data * trying to fix some tests * set correct token * trying to fix tracking failure * minor tweaks and fixes * fix more tests * fix screenshot test * trigger event so brute force logic is executed * test no fallback to actual authentication * allow fallback * apply review feedback * fix some tests * fix tests * make sure location values from query params are limited properly before attempting a db insert * make sure plugin uninstall migration reloads plugins, make sure 4.0.0-b1 migration removes unique index that is no longer used, use defaults extra file in SqlDump to get test to run on travis * Fix UI tests. * update expected screenshot Co-authored-by: Stefan Giehl <[email protected]> Co-authored-by: diosmosis <[email protected]>
- Loading branch information
1 parent
e493fee
commit f0c246c
Showing
91 changed files
with
1,464 additions
and
389 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
use Piwik\Db; | ||
use Piwik\DbHelper; | ||
use Piwik\Option; | ||
use Piwik\Plugins\UsersManager\Model; | ||
use Piwik\Version; | ||
|
||
/** | ||
|
@@ -45,12 +46,24 @@ public function getTablesCreateSql() | |
alias VARCHAR(45) NOT NULL, | ||
email VARCHAR(100) NOT NULL, | ||
twofactor_secret VARCHAR(40) NOT NULL DEFAULT '', | ||
token_auth CHAR(32) NOT NULL, | ||
superuser_access TINYINT(2) unsigned NOT NULL DEFAULT '0', | ||
date_registered TIMESTAMP NULL, | ||
ts_password_modified TIMESTAMP NULL, | ||
PRIMARY KEY(login), | ||
UNIQUE KEY uniq_keytoken(token_auth) | ||
PRIMARY KEY(login) | ||
) ENGINE=$engine DEFAULT CHARSET=utf8 | ||
", | ||
'user_token_auth' => "CREATE TABLE {$prefixTables}user_token_auth ( | ||
idusertokenauth BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, | ||
login VARCHAR(100) NOT NULL, | ||
description VARCHAR(".Model::MAX_LENGTH_TOKEN_DESCRIPTION.") NOT NULL, | ||
password VARCHAR(255) NOT NULL, | ||
hash_algo VARCHAR(30) NOT NULL, | ||
system_token TINYINT(1) NOT NULL DEFAULT 0, | ||
last_used DATETIME NULL, | ||
date_created DATETIME NOT NULL, | ||
date_expired DATETIME NULL, | ||
PRIMARY KEY(idusertokenauth), | ||
UNIQUE KEY uniq_password(password) | ||
) ENGINE=$engine DEFAULT CHARSET=utf8 | ||
", | ||
|
||
|
@@ -504,12 +517,15 @@ public function createTables() | |
public function createAnonymousUser() | ||
{ | ||
$now = Date::factory('now')->getDatetime(); | ||
|
||
// The anonymous user is the user that is assigned by default | ||
// note that the token_auth value is anonymous, which is assigned by default as well in the Login plugin | ||
$db = $this->getDb(); | ||
$db->query("INSERT IGNORE INTO " . Common::prefixTable("user") . " | ||
VALUES ( 'anonymous', '', 'anonymous', '[email protected]', '', 'anonymous', 0, '$now', '$now' );"); | ||
(`login`, `password`, `alias`, `email`, `twofactor_secret`, `superuser_access`, `date_registered`, `ts_password_modified`) | ||
VALUES ( 'anonymous', '', 'anonymous', '[email protected]', '', 0, '$now', '$now' );"); | ||
|
||
$model = new Model(); | ||
$model->addTokenAuth('anonymous', 'anonymous', 'anonymous default token', $now); | ||
} | ||
|
||
/** | ||
|
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
Oops, something went wrong.