-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Verify personal data #3869
Verify personal data #3869
Changes from all commits
1fc05ea
c9ccdca
6f41a3e
cbf5acc
866e5d6
94df091
86701dc
7c309c2
f3c433a
391a989
5c20288
f32304f
71657db
2a07ec8
06265fe
ebcb847
46dd549
17ad812
08a33cc
9a366db
67057f7
6a48548
59e8a19
27b676b
ee61570
75c5bec
c1a784e
981c110
5fa0e6d
a0ca1c0
47985a1
de529b9
e40bdcd
9c0414b
ec452a8
e9021c1
4607916
2d07179
072d69f
68ba857
9480b29
806ca43
df1d1c6
4ec05ef
7340d6a
5464b14
9b36f2d
e3b10f3
f488258
a0bf706
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,24 @@ | |
\OC::$server->getAppDataDir('identityproof'), | ||
\OC::$server->getCrypto() | ||
); | ||
|
||
$config = \OC::$server->getConfig(); | ||
$lookupServer = $config->getSystemValue('lookup_server', ''); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No default value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default value is that nothing is configured and than the lookup connector will fall back to the default URL. |
||
|
||
$updateLookupServer = new \OCA\LookupServerConnector\UpdateLookupServer( | ||
new \OC\Accounts\AccountManager(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher()), | ||
\OC::$server->getConfig(), | ||
\OC::$server->getSecureRandom(), | ||
new \OC\Accounts\AccountManager( | ||
\OC::$server->getDatabaseConnection(), | ||
\OC::$server->getEventDispatcher(), | ||
\OC::$server->getJobList() | ||
), | ||
\OC::$server->getHTTPClientService(), | ||
$keyManager, | ||
new \OC\Security\IdentityProof\Signer( | ||
$keyManager, | ||
new \OC\AppFramework\Utility\TimeFactory(), | ||
\OC::$server->getUserManager() | ||
), | ||
\OC::$server->getJobList() | ||
\OC::$server->getJobList(), | ||
$lookupServer | ||
); | ||
$updateLookupServer->userUpdated($user); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,11 @@ | |
namespace OCA\LookupServerConnector; | ||
|
||
use OC\Accounts\AccountManager; | ||
use OC\Security\IdentityProof\Manager; | ||
use OC\Security\IdentityProof\Signer; | ||
use OCA\LookupServerConnector\BackgroundJobs\RetryJob; | ||
use OCP\BackgroundJob\IJobList; | ||
use OCP\Http\Client\IClientService; | ||
use OCP\IConfig; | ||
use OCP\IUser; | ||
use OCP\Security\ISecureRandom; | ||
|
||
/** | ||
* Class UpdateLookupServer | ||
|
@@ -40,44 +37,36 @@ | |
class UpdateLookupServer { | ||
/** @var AccountManager */ | ||
private $accountManager; | ||
/** @var IConfig */ | ||
private $config; | ||
/** @var ISecureRandom */ | ||
private $secureRandom; | ||
/** @var IClientService */ | ||
private $clientService; | ||
/** @var Manager */ | ||
private $keyManager; | ||
/** @var Signer */ | ||
private $signer; | ||
/** @var IJobList */ | ||
private $jobList; | ||
/** @var string URL point to lookup server */ | ||
private $lookupServer = 'https://lookup.nextcloud.com/users'; | ||
private $lookupServer = 'https://lookup.nextcloud.com'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the default while fetching from the config instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to have the default defined in one place instead of spread around in multiple places. This makes it much easier to change it if necessary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem I see with this approach: How to set "no lookup server"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is always one configured lookup server. That's also the case for Nc11. You can disable the whole functionality in the admin settings, no need to play around with config.php variables. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can still have the default server stored in a const, if you need it in several places, and use it as default parameter. It's a more intuitive and especially consistent. |
||
|
||
/** | ||
* @param AccountManager $accountManager | ||
* @param IConfig $config | ||
* @param ISecureRandom $secureRandom | ||
* @param IClientService $clientService | ||
* @param Manager $manager | ||
* @param Signer $signer | ||
* @param IJobList $jobList | ||
* @param string $lookupServer if nothing is given we use the default lookup server | ||
*/ | ||
public function __construct(AccountManager $accountManager, | ||
IConfig $config, | ||
ISecureRandom $secureRandom, | ||
IClientService $clientService, | ||
Manager $manager, | ||
Signer $signer, | ||
IJobList $jobList) { | ||
IJobList $jobList, | ||
$lookupServer = '') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to: #3869 (comment) |
||
$this->accountManager = $accountManager; | ||
$this->config = $config; | ||
$this->secureRandom = $secureRandom; | ||
$this->clientService = $clientService; | ||
$this->keyManager = $manager; | ||
$this->signer = $signer; | ||
$this->jobList = $jobList; | ||
if ($lookupServer !== '') { | ||
$this->lookupServer = $lookupServer; | ||
} | ||
$this->lookupServer = rtrim($this->lookupServer, '/'); | ||
$this->lookupServer .= '/users'; | ||
} | ||
|
||
/** | ||
|
@@ -113,6 +102,13 @@ protected function sendToLookupServer(IUser $user, array $publicData) { | |
$dataArray['website'] = isset($publicData[AccountManager::PROPERTY_WEBSITE]) ? $publicData[AccountManager::PROPERTY_WEBSITE]['value'] : ''; | ||
$dataArray['twitter'] = isset($publicData[AccountManager::PROPERTY_TWITTER]) ? $publicData[AccountManager::PROPERTY_TWITTER]['value'] : ''; | ||
$dataArray['phone'] = isset($publicData[AccountManager::PROPERTY_PHONE]) ? $publicData[AccountManager::PROPERTY_PHONE]['value'] : ''; | ||
$dataArray['twitter_signature'] = isset($publicData[AccountManager::PROPERTY_TWITTER]['signature']) ? $publicData[AccountManager::PROPERTY_TWITTER]['signature'] : ''; | ||
$dataArray['website_signature'] = isset($publicData[AccountManager::PROPERTY_WEBSITE]['signature']) ? $publicData[AccountManager::PROPERTY_WEBSITE]['signature'] : ''; | ||
$dataArray['verificationStatus'] = | ||
[ | ||
AccountManager::PROPERTY_WEBSITE => isset($publicData[AccountManager::PROPERTY_WEBSITE]) ? $publicData[AccountManager::PROPERTY_WEBSITE]['verified'] : '', | ||
AccountManager::PROPERTY_TWITTER => isset($publicData[AccountManager::PROPERTY_TWITTER]) ? $publicData[AccountManager::PROPERTY_TWITTER]['verified'] : '', | ||
]; | ||
} | ||
|
||
$dataArray = $this->signer->sign('lookupserver', $dataArray, $user); | ||
|
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.
Please
rtrim('/')
because people will mostlikely add a trailing slash, which might or might not cause problems...