2 declare(strict_types = 1);
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
42 'Backend login with securityLevel "normal"' => [
47 'uident' =>
'password',
52 'uident' =>
'password',
53 'uident_text' =>
'password',
56 'Frontend login with securityLevel "normal"' => [
61 'uident' =>
'password',
66 'uident' =>
'password',
67 'uident_text' =>
'password',
81 $subject->processLoginData($loginData, $passwordSubmissionStrategy);
82 $this->assertEquals($expectedProcessedData, $loginData);
91 $subject->initAuth(
'mode', [
'uident_text' =>
'',
'uname' =>
'user'], [],
null);
92 $this->assertSame(100, $subject->authUser([]));
101 $subject->initAuth(
'mode', [
'uident_text' =>
'foo',
'uname' =>
''], [],
null);
102 $this->assertSame(100, $subject->authUser([]));
111 $subject->initAuth(
'mode', [
'uident_text' =>
'password',
'uname' =>
'user'], [],
null);
112 $this->expectException(\RuntimeException::class);
113 $this->expectExceptionCode(1533159150);
114 $subject->authUser([]);
123 $pObjProphecy = $this->prophesize(AbstractUserAuthentication::class);
124 $loggerProphecy = $this->prophesize(Logger::class);
125 $subject->setLogger($loggerProphecy->reveal());
129 'uident_text' =>
'password',
133 'db_user' => [
'table' =>
'be_users'],
136 $pObjProphecy->reveal()
139 'password' =>
'aPlainTextPassword',
142 $this->expectException(InvalidPasswordHashException::class);
143 $this->expectExceptionCode(1533818591);
144 $subject->authUser($dbUser);
153 $pObjProphecy = $this->prophesize(AbstractUserAuthentication::class);
154 $loggerProphecy = $this->prophesize(Logger::class);
155 $subject->setLogger($loggerProphecy->reveal());
159 'uident_text' =>
'notMyPassword',
163 'db_user' => [
'table' =>
'be_users'],
166 $pObjProphecy->reveal()
170 'password' =>
'$P$C/2Vr3ywuuPo5C7cs75YBnVhgBWpMP1',
173 $this->assertSame(0, $subject->authUser($dbUser));
182 $pObjProphecy = $this->prophesize(AbstractUserAuthentication::class);
183 $loggerProphecy = $this->prophesize(Logger::class);
184 $subject->setLogger($loggerProphecy->reveal());
188 'uident_text' =>
'myPassword',
192 'db_user' => [
'table' =>
'be_users'],
195 $pObjProphecy->reveal()
199 'password' =>
'$argon2i$v=19$m=65536,t=16,p=1$eGpyelFZbkpRdXN3QVhsUA$rd4abz2fcuksGu3b3fipglQZtHbIy+M3XoIS+sNVSl4',
202 $this->assertSame(200, $subject->authUser($dbUser));
211 $pObjProphecy = $this->prophesize(AbstractUserAuthentication::class);
212 $loggerProphecy = $this->prophesize(Logger::class);
213 $subject->setLogger($loggerProphecy->reveal());
217 'uident_text' =>
'myPassword',
222 'table' =>
'be_users',
223 'username_column' =>
'username',
226 'HTTP_HOST' =>
'example.com',
228 $pObjProphecy->reveal()
232 'password' =>
'$argon2i$v=19$m=65536,t=16,p=2$LnUzc3ZISWJwQWlSbmpkYw$qD1sRsJFzkUmjcEaKzDeg6LtflwdTpo49VbH3tMeMXU',
233 'username' =>
'lolli',
234 'lockToDomain' =>
'not.example.com'
236 $this->assertSame(0, $subject->authUser($dbUser));