hashing -> hash
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -6,9 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- SHA512 Whirlpool hashing algorithm
|
- SHA512 Whirlpool hash algorithm
|
||||||
- WoltLab Community Framework 2.x hashing algorithm
|
- WoltLab Community Framework 2.x hash algorithm
|
||||||
- phpass hashing implementation
|
- phpass hash implementation
|
||||||
- Support for salt column
|
- Support for salt column
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@@ -26,7 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [4.0.0-rc1] - 2018-06-13
|
## [4.0.0-rc1] - 2018-06-13
|
||||||
### Added
|
### Added
|
||||||
- New hashing algorithms: Argon2 Crypt (PHP 7.2 and above), Blowfish Crypt, Courier base64-encoded MD5, Courier base64-encoded SHA1, Courier base64-encoded SHA256, Courier hexadecimal MD5, Extended DES Crypt, SHA256 Crypt, SHA512 Crypt, SSHA512, Standard DES Crypt
|
- New hash algorithms: Argon2 Crypt (PHP 7.2 and above), Blowfish Crypt, Courier base64-encoded MD5, Courier base64-encoded SHA1, Courier base64-encoded SHA256, Courier hexadecimal MD5, Extended DES Crypt, SHA256 Crypt, SHA512 Crypt, SSHA512, Standard DES Crypt
|
||||||
- Option to allow users to change their display names
|
- Option to allow users to change their display names
|
||||||
- Option to allow user to change its avatar
|
- Option to allow user to change its avatar
|
||||||
- Database query results cache
|
- Database query results cache
|
||||||
@@ -38,9 +38,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- Minimum supported PHP version - 7.0
|
- Minimum supported PHP version - 7.0
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- MySQL ENCRYPT() hashing implementation - Function is deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release.
|
- MySQL ENCRYPT() hash implementation - Function is deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release.
|
||||||
- MySQL PASSWORD() hashing implementation - Function is deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release.
|
- MySQL PASSWORD() hash implementation - Function is deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release.
|
||||||
- Redmine hashing implementation - Cannot implement in new core system.
|
- Redmine hash implementation - Cannot implement in new core system.
|
||||||
- User active column - Use database view instead
|
- User active column - Use database view instead
|
||||||
- Domain support
|
- Domain support
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Name | Description | Details
|
|||||||
**Allow display name change** | With this option enabled user can change its display name. The display name change is propagated to the database. | Optional.<br/>Default: false.<br/>Requires: user *Display name* column.
|
**Allow display name change** | With this option enabled user can change its display name. The display name change is propagated to the database. | Optional.<br/>Default: false.<br/>Requires: user *Display name* column.
|
||||||
**Allow password change** | Can user change its password. The password change is propagated to the database. See [Hash algorithms](#hash-algorithms). | Optional.<br/>Default: false.
|
**Allow password change** | Can user change its password. The password change is propagated to the database. See [Hash algorithms](#hash-algorithms). | Optional.<br/>Default: false.
|
||||||
**Use cache** | Use database query results cache. The cache can be cleared any time with the *Clear cache* button click. | Optional.<br/>Default: false.
|
**Use cache** | Use database query results cache. The cache can be cleared any time with the *Clear cache* button click. | Optional.<br/>Default: false.
|
||||||
**Hashing algorithm** | How users passwords are stored in the database. See [Hash algorithms](#hash-algorithms). | Mandatory.
|
**Hash algorithm** | How users passwords are stored in the database. See [Hash algorithms](#hash-algorithms). | Mandatory.
|
||||||
**Email sync** | Sync e-mail address with the Nextcloud.<br/>- *None* - Disables this feature. This is the default option.<br/>- *Synchronise only once* - Copy the e-mail address to the Nextcloud storage if its not set.<br/>- *Nextcloud always wins* - Always copy the e-mail address to the database. This updates the user table.<br/>- *SQL always wins* - Always copy the e-mail address to the Nextcloud storage. | Optional.<br/>Default: *None*.<br/>Requires: user *Email* column.
|
**Email sync** | Sync e-mail address with the Nextcloud.<br/>- *None* - Disables this feature. This is the default option.<br/>- *Synchronise only once* - Copy the e-mail address to the Nextcloud storage if its not set.<br/>- *Nextcloud always wins* - Always copy the e-mail address to the database. This updates the user table.<br/>- *SQL always wins* - Always copy the e-mail address to the Nextcloud storage. | Optional.<br/>Default: *None*.<br/>Requires: user *Email* column.
|
||||||
**Home mode** | User storage path.<br/>- *Default* - Let the Nextcloud manage this. The default option.<br/>- *Query* - Use location from the user table pointed by the *home* column.<br/>- *Static* - Use static location. The `%u` variable is replaced with the username of the user. | Optional<br/>Default: *Default*.
|
**Home mode** | User storage path.<br/>- *Default* - Let the Nextcloud manage this. The default option.<br/>- *Query* - Use location from the user table pointed by the *home* column.<br/>- *Static* - Use static location. The `%u` variable is replaced with the username of the user. | Optional<br/>Default: *Default*.
|
||||||
**Home Location** | User storage path for the `static` *home mode*. | Mandatory if the *Home mode* is set to `Static`.
|
**Home Location** | User storage path for the `static` *home mode*. | Mandatory if the *Home mode* is set to `Static`.
|
||||||
@@ -146,7 +146,7 @@ User table: wp_users
|
|||||||
Username column: user_login
|
Username column: user_login
|
||||||
Password column: user_pass
|
Password column: user_pass
|
||||||
|
|
||||||
Hashing algorithm: Unix (Crypt) or Portable PHP password
|
Hash algorithm: Unix (Crypt) or Portable PHP password
|
||||||
```
|
```
|
||||||
|
|
||||||
#### JHipster
|
#### JHipster
|
||||||
@@ -163,7 +163,7 @@ Password column: password_hash
|
|||||||
Email column: email
|
Email column: email
|
||||||
Active column: activated
|
Active column: activated
|
||||||
|
|
||||||
Hashing algorithm: Unix (Crypt)
|
Hash algorithm: Unix (Crypt)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Hash algorithms
|
## Hash algorithms
|
||||||
@@ -203,7 +203,7 @@ Add a new class in the `OCA\UserSQL\Platform` namespace which extends the `Abstr
|
|||||||
Add this driver in `admin.php` template to `$drivers` variable and in method `getPlatform(Connection $connection)`
|
Add this driver in `admin.php` template to `$drivers` variable and in method `getPlatform(Connection $connection)`
|
||||||
of `PlatformFactory` class.
|
of `PlatformFactory` class.
|
||||||
|
|
||||||
#### New hashing algorithm support
|
#### New hash algorithm support
|
||||||
|
|
||||||
Create a new class in `OCA\UserSQL\Crypto` namespace which implements `IPasswordAlgorithm` interface.
|
Create a new class in `OCA\UserSQL\Crypto` namespace which implements `IPasswordAlgorithm` interface.
|
||||||
Do not forget to write unit tests.
|
Do not forget to write unit tests.
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
namespace OCA\UserSQL\Crypto;
|
namespace OCA\UserSQL\Crypto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Unix Crypt hashing implementation.
|
* Abstract Unix Crypt hash implementation.
|
||||||
* The hashing algorithm depends on the chosen salt.
|
* The hash algorithm depends on the chosen salt.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
@@ -52,7 +52,7 @@ abstract class AbstractCrypt extends AbstractAlgorithm
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a salt string for the hashing algorithm.
|
* Generate a salt string for the hash algorithm.
|
||||||
*
|
*
|
||||||
* @return string The salt string.
|
* @return string The salt string.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Courier MD5 hashing implementation.
|
* Courier MD5 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Courier MD5 RAW hashing implementation.
|
* Courier MD5 RAW hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Courier SHA1 hashing implementation.
|
* Courier SHA1 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Courier SHA256 hashing implementation.
|
* Courier SHA256 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unix Crypt hashing implementation.
|
* Unix Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Argon2 Crypt hashing implementation.
|
* Argon2 Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blowfish Crypt hashing implementation.
|
* Blowfish Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended DES Crypt hashing implementation.
|
* Extended DES Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MD5 Crypt hashing implementation.
|
* MD5 Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SHA256 Crypt hashing implementation.
|
* SHA256 Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SHA512 Crypt hashing implementation.
|
* SHA512 Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @see crypt()
|
* @see crypt()
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard DES Crypt hashing implementation.
|
* Standard DES Crypt hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Joomla hashing implementation.
|
* Joomla hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MD5 hashing implementation.
|
* MD5 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpass hashing implementation.
|
* phpass hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SHA1 hashing implementation.
|
* SHA1 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SHA512 Whirlpool hashing implementation.
|
* SHA512 Whirlpool hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSHA* hashing implementation.
|
* SSHA* hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSHA256 hashing implementation.
|
* SSHA256 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OCA\UserSQL\Crypto;
|
|||||||
use OCP\IL10N;
|
use OCP\IL10N;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSHA512 hashing implementation.
|
* SSHA512 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
namespace OCA\UserSQL\Crypto;
|
namespace OCA\UserSQL\Crypto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WCF2 hashing implementation.
|
* WCF2 hash implementation.
|
||||||
*
|
*
|
||||||
* @author Marcin Łojewski <dev@mlojewski.me>
|
* @author Marcin Łojewski <dev@mlojewski.me>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ function print_select_options(
|
|||||||
<input type="submit" id="user_sql-clear_cache" value="<?php p($l->t("Clear cache")); ?>">
|
<input type="submit" id="user_sql-clear_cache" value="<?php p($l->t("Clear cache")); ?>">
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
$hashing = [];
|
$hashes = [];
|
||||||
foreach (glob(__DIR__ . "/../lib/Crypto/*.php") as $filename) {
|
foreach (glob(__DIR__ . "/../lib/Crypto/*.php") as $filename) {
|
||||||
$class = 'OCA\\UserSQL\\Crypto\\' . basename(substr($filename, 0, -4));
|
$class = 'OCA\\UserSQL\\Crypto\\' . basename(substr($filename, 0, -4));
|
||||||
try {
|
try {
|
||||||
@@ -123,13 +123,13 @@ function print_select_options(
|
|||||||
if ($passwordAlgorithm instanceof
|
if ($passwordAlgorithm instanceof
|
||||||
\OCA\UserSQL\Crypto\IPasswordAlgorithm
|
\OCA\UserSQL\Crypto\IPasswordAlgorithm
|
||||||
) {
|
) {
|
||||||
$hashing[$class] = $passwordAlgorithm->getVisibleName();
|
$hashes[$class] = $passwordAlgorithm->getVisibleName();
|
||||||
}
|
}
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print_select_options($l, "opt-crypto_class", "Hashing algorithm", $hashing, $_['opt.crypto_class']);
|
print_select_options($l, "opt-crypto_class", "Hash algorithm", $hashes, $_['opt.crypto_class']);
|
||||||
print_select_options($l, "opt-email_sync", "Email sync", ["" => "None", "initial" => "Synchronise only once", "force_nc"=>"Nextcloud always wins", "force_sql"=>"SQL always wins"], $_['opt.email_sync']);
|
print_select_options($l, "opt-email_sync", "Email sync", ["" => "None", "initial" => "Synchronise only once", "force_nc"=>"Nextcloud always wins", "force_sql"=>"SQL always wins"], $_['opt.email_sync']);
|
||||||
print_select_options($l, "opt-home_mode", "Home mode", ["" => "Default", "query" => "Query", "static" => "Static"], $_['opt.home_mode']);
|
print_select_options($l, "opt-home_mode", "Home mode", ["" => "Default", "query" => "Query", "static" => "Static"], $_['opt.home_mode']);
|
||||||
print_text_input($l, "opt-home_location", "Home Location", $_['opt.home_location']); ?>
|
print_text_input($l, "opt-home_location", "Home Location", $_['opt.home_location']); ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user