Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-05-29 13:18:10 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-06-18 23:11:55 +0300
commit4bbc21cb216c51ab22f31089c9c09a3dec8980dc (patch)
tree5f2322a324a87bea1f8586e0789d602f99773c94 /lib/private/Authentication/Token/PublicKeyTokenProvider.php
parent4c0d7104792cb89b8bc013c08b9c9fcb63dcf0da (diff)
SetPassword on PublicKeyTokens
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Authentication/Token/PublicKeyTokenProvider.php')
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index 926e3c678d4..5c97877e730 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -215,9 +215,19 @@ class PublicKeyTokenProvider implements IProvider {
}
public function setPassword(IToken $token, string $tokenId, string $password) {
- // Kill all temp tokens except the current token
+ if (!($token instanceof PublicKeyToken)) {
+ throw new InvalidTokenException();
+ }
+
+ // Update the password for all tokens
+ $tokens = $this->mapper->getTokenByUser($token->getUID());
+ foreach ($tokens as $t) {
+ $publicKey = $token->getPublicKey();
+ $t->setPassword($this->encryptPassword($password, $publicKey));
+ $this->updateToken($t);
+ }
- // Update pass for all permanent tokens by rencrypting
+ //TODO: should we also do this for temp tokens?
}
public function rotate(IToken $token, string $oldTokenId, string $newTokenId): IToken {