Skip to content

Commit 4aa4dd9

Browse files
committed
Adopt SSP coding-style
1 parent e8258d1 commit 4aa4dd9

File tree

7 files changed

+33
-4
lines changed

7 files changed

+33
-4
lines changed

src/Auth/InvalidCredentialResult.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,25 @@ class InvalidCredentialResult
2626
* @see https://ldapwiki.com/wiki/Common%20Active%20Directory%20Bind%20Errors
2727
*/
2828
public const LDAP_NO_SUCH_OBJECT = '525';
29+
2930
public const ERROR_LOGON_FAILURE = '52e';
31+
3032
public const ERROR_ACCOUNT_RESTRICTION = '52f';
33+
3134
public const ERROR_INVALID_LOGON_HOURS = '530';
35+
3236
public const ERROR_INVALID_WORKSTATION = '531';
37+
3338
public const ERROR_PASSWORD_EXPIRED = '532';
39+
3440
public const ERROR_ACCOUNT_DISABLED = '533';
41+
3542
public const ERROR_TOO_MANY_CONTEXT_IDS = '568';
43+
3644
public const ERROR_ACCOUNT_EXPIRED = '701';
45+
3746
public const ERROR_PASSWORD_MUST_CHANGE = '773';
47+
3848
public const ERROR_ACCOUNT_LOCKED_OUT = '775';
3949

4050
/**
@@ -43,17 +53,23 @@ class InvalidCredentialResult
4353
* N.B. - This is an incomplete list
4454
*/
4555
public const NT_STATUS_PASSWORD_EXPIRED = 'PASSWORD_EXPIRED';
56+
4657
public const NT_STATUS_PASSWORD_MUST_CHANGE = 'PASSWORD_MUST_CHANGE';
58+
4759
public const NT_STATUS_LOGON_FAILURE = 'LOGON_FAILURE';
4860

4961
/**
5062
* List of keys for the code mapping
5163
*/
5264
public const KEY_INVALID_CREDENTIAL = 'invalid_credential';
65+
5366
public const KEY_PASSWORD_ERROR = 'password_error';
67+
5468
public const KEY_ACCOUNT_ERROR = 'account_error';
69+
5570
public const KEY_RESTRICTION = 'restriction';
5671

72+
5773
/**
5874
* Map of keys to check the code against when using is* methods
5975
*

src/Auth/Process/AttributeAddFromLDAP.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class AttributeAddFromLDAP extends BaseFilter
5252
/** @var string|null */
5353
protected ?string $searchPassword;
5454

55+
5556
/**
5657
* Initialize this filter.
5758
*

src/Auth/Process/BaseFilter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111

1212
namespace SimpleSAML\Module\ldap\Auth\Process;
1313

14-
use SimpleSAML\{Auth, Configuration, Error, Logger};
14+
use SimpleSAML\Auth;
15+
use SimpleSAML\Configuration;
16+
use SimpleSAML\Error;
17+
use SimpleSAML\Logger;
1518
use SimpleSAML\Module\ldap\ConnectorFactory;
1619
use SimpleSAML\Module\ldap\ConnectorInterface;
1720

src/Auth/Source/Ldap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ protected function loginSasl(
163163
return $this->processAttributes(/** @scrutinizer-ignore-type */$entry);
164164
}
165165

166+
166167
/**
167168
* Attempt to log in using the given username and password.
168169
*

src/Connector/ActiveDirectory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
class ActiveDirectory extends Ldap
1515
{
1616
public const ERR_PASSWORD_RESET = 'RESETPASSWORD';
17+
1718
public const ERR_ACCOUNT_RESET = 'RESETACCOUNT';
19+
1820
public const ERR_LOGON_RESTRICTION = 'LOGONRESTRICTION';
1921

2022

src/Connector/Ldap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Ldap implements ConnectorInterface
2727
{
2828
use LdapHelpers;
2929

30+
3031
/**
3132
* @var \Symfony\Component\Ldap\Adapter\AdapterInterface
3233
*/
@@ -109,6 +110,7 @@ public function bind(?string $username, #[\SensitiveParameter]?string $password)
109110
}
110111
}
111112

113+
112114
/**
113115
* @inheritDoc
114116
*/
@@ -138,6 +140,7 @@ public function saslBind(
138140
}
139141
}
140142

143+
141144
/**
142145
* @inheritDoc
143146
*/
@@ -150,6 +153,7 @@ public function whoami(): string
150153
return $this->connection->whoami();
151154
}
152155

156+
153157
/**
154158
* @inheritDoc
155159
*/

tests/src/Auth/Source/LdapTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public static function setUpBeforeClass(): void
2929
Configuration::setPreLoadedConfig($sourceConfig, 'authsources.php');
3030
}
3131

32+
3233
public function buildSourceMock(): Ldap
3334
{
3435
$mb = $this->getMockBuilder(ConnectorInterface::class);
@@ -51,11 +52,12 @@ public function __construct(ConnectorInterface $connector)
5152
};
5253
}
5354

55+
5456
public function testLogin(): void
5557
{
5658
$source = $this->buildSourceMock();
57-
/** @psalm-var \PHPUnit\Framework\MockObject\MockObject $connector */
5859
$connector = $source->getConnector();
60+
/** @phpstan-ignore method.notFound */
5961
$connector->method('search')->willReturn(
6062
new Entry('test', ['test1' => ['testval1']]),
6163
);
@@ -76,8 +78,8 @@ public function testLogin(): void
7678
public function testGetAttributes(): void
7779
{
7880
$source = $this->buildSourceMock();
79-
/** @psalm-var \PHPUnit\Framework\MockObject\MockObject $connector */
8081
$connector = $source->getConnector();
82+
/** @phpstan-ignore method.notFound */
8183
$connector->method('search')->willReturn(
8284
new Entry('test', ['test2' => ['testval2']]),
8385
);
@@ -90,7 +92,7 @@ public function testGetAttributes(): void
9092
public function testGetAttributesWithAttributesSetToNull(): void
9193
{
9294
$source = $this->buildSourceMock();
93-
/** @psalm-var \PHPUnit\Framework\MockObject\MockObject $connector */
95+
/** @phpstan-ignore method.notFound */
9496
$connector = $source->getConnector();
9597
$connector->method('search')->willReturn(
9698
new Entry('test', ['test1' => ['testval1'], 'test2' => ['testval2'], 'test3' => ['testval3']]),

0 commit comments

Comments
 (0)