diff options
author | Julius Knorr <jus@bitgrid.net> | 2025-02-28 11:59:10 +0100 |
---|---|---|
committer | Julius Knorr <jus@bitgrid.net> | 2025-03-06 09:31:29 +0100 |
commit | 777cd941dc1bf7009bbb8465afd907c75b4d2d7b (patch) | |
tree | 3a630dc3093933db9e52c8d6becbc5521c7b1472 /tests | |
parent | 373107b6e4ebfd3487c69a122ff3230057a4ae51 (diff) | |
download | nextcloud-server-777cd941dc1bf7009bbb8465afd907c75b4d2d7b.tar.gz nextcloud-server-777cd941dc1bf7009bbb8465afd907c75b4d2d7b.zip |
fix: Do not build encrypted password if there is nonefix/credential-passwordless-auth
Signed-off-by: Julius Knorr <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Authentication/LoginCredentials/StoreTest.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php index c58bb09faaa..072ec2ab571 100644 --- a/tests/lib/Authentication/LoginCredentials/StoreTest.php +++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php @@ -253,4 +253,44 @@ class StoreTest extends TestCase { $this->store->getLoginCredentials(); } + + public function testAuthenticatePasswordlessToken(): void { + $user = 'user987'; + $password = null; + + $params = [ + 'run' => true, + 'loginName' => $user, + 'uid' => $user, + 'password' => $password, + ]; + + $this->session->expects($this->once()) + ->method('set') + ->with($this->equalTo('login_credentials'), $this->equalTo(json_encode($params))); + + + $this->session->expects($this->once()) + ->method('getId') + ->willReturn('sess2233'); + $this->tokenProvider->expects($this->once()) + ->method('getToken') + ->with('sess2233') + ->will($this->throwException(new PasswordlessTokenException())); + + $this->session->expects($this->once()) + ->method('exists') + ->with($this->equalTo('login_credentials')) + ->willReturn(true); + $this->session->expects($this->once()) + ->method('get') + ->with($this->equalTo('login_credentials')) + ->willReturn(json_encode($params)); + + $this->store->authenticate($params); + $actual = $this->store->getLoginCredentials(); + + $expected = new Credentials($user, $user, $password); + $this->assertEquals($expected, $actual); + } } |