Skip to content

Commit 97d50e5

Browse files
committed
Fixes for modules/negotiate
1 parent c75b81b commit 97d50e5

3 files changed

Lines changed: 219 additions & 2 deletions

File tree

modules/negotiate/lib/Auth/Source/Negotiate.php

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,49 @@ class Negotiate extends \SimpleSAML\Auth\Source
1616
// Constants used in the module
1717
const STAGEID = '\SimpleSAML\Module\negotiate\Auth\Source\Negotiate.StageId';
1818

19+
/** @var \SimpleSAML\Auth\LDAP|null */
1920
protected $ldap = null;
21+
22+
/** @var string */
2023
protected $backend = '';
24+
25+
/** @var string*/
2126
protected $hostname = '';
27+
28+
/** @var int */
2229
protected $port = 389;
30+
31+
/** @var bool */
2332
protected $referrals = true;
33+
34+
/** @var bool */
2435
protected $enableTLS = false;
36+
37+
/** @var bool */
2538
protected $debugLDAP = false;
39+
40+
/** @var int */
2641
protected $timeout = 30;
42+
43+
/** @var string */
2744
protected $keytab = '';
45+
46+
/** @var array */
2847
protected $base = [];
48+
49+
/** @var array */
2950
protected $attr = ['uid'];
51+
52+
/** @var array|null */
3053
protected $subnet = null;
54+
55+
/** @var string|null */
3156
protected $admin_user = null;
57+
58+
/** @var string|null */
3259
protected $admin_pw = null;
60+
61+
/** @var array|null */
3362
protected $attributes = null;
3463

3564

@@ -81,6 +110,7 @@ public function __construct($info, $config)
81110
* LDAP is used as a user metadata source.
82111
*
83112
* @param array &$state Information about the current authentication.
113+
* @return void
84114
*/
85115
public function authenticate(&$state)
86116
{
@@ -187,6 +217,10 @@ public function authenticate(&$state)
187217
}
188218

189219

220+
/**
221+
* @param array $spMetadata
222+
* @return bool
223+
*/
190224
public function spDisabledInMetadata($spMetadata)
191225
{
192226
if (array_key_exists('negotiate:disable', $spMetadata)) {
@@ -209,7 +243,7 @@ public function spDisabledInMetadata($spMetadata)
209243
*
210244
* Will return TRUE if no subnet option is configured.
211245
*
212-
* @return boolean
246+
* @return bool
213247
*/
214248
public function checkMask()
215249
{
@@ -235,6 +269,7 @@ public function checkMask()
235269
* wants to show the 401 message.
236270
*
237271
* @param array $params additional parameters to the URL in the URL in the body.
272+
* @return void
238273
*/
239274
protected function sendNegotiate($params)
240275
{
@@ -256,6 +291,7 @@ protected function sendNegotiate($params)
256291
* Passes control of the login process to a different module.
257292
*
258293
* @param array $state Information about the current authentication.
294+
* @return void
259295
*
260296
* @throws \SimpleSAML\Error\Error If couldn't determine the auth source.
261297
* @throws \SimpleSAML\Error\Exception
@@ -290,7 +326,7 @@ public static function fallBack(&$state)
290326
*
291327
* @param string $user The Kerberos user identifier.
292328
*
293-
* @return string The DN to the user or NULL if not found.
329+
* @return array|null The attributes for the user or NULL if not found.
294330
*/
295331
protected function lookupUserData($user)
296332
{
@@ -315,6 +351,9 @@ protected function lookupUserData($user)
315351
/**
316352
* Elevates the LDAP connection to allow restricted lookups if
317353
* so configured. Does nothing if not.
354+
*
355+
* @return void
356+
* @throws \SimpleSAML\Error\AuthSource
318357
*/
319358
protected function adminBind()
320359
{
@@ -339,6 +378,7 @@ protected function adminBind()
339378
* logout call to the fallback module.
340379
*
341380
* @param array &$state Information about the current logout operation.
381+
* @return void
342382
*/
343383
public function logout(&$state)
344384
{

psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@
2727
<UnusedClass errorLevel="info" />
2828
<PossiblyUnusedMethod errorLevel="info" />
2929
</issueHandlers>
30+
31+
<stubs>
32+
<file name="tests/Utils/Stubs/krb5.php" />
33+
</stubs>
3034
</psalm>

tests/Utils/Stubs/krb5.php

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<?php
2+
3+
class KRB5NegotiateAuth
4+
{
5+
/**
6+
* @param string $keytab
7+
* @param string $spn
8+
*/
9+
public function __construct($keytab, $spn)
10+
{
11+
}
12+
13+
14+
/**
15+
* @return bool
16+
*/
17+
public function doAuthentication()
18+
{
19+
}
20+
21+
22+
/**
23+
* @return string
24+
*/
25+
public function getAuthenticatedUser()
26+
{
27+
}
28+
29+
30+
/**
31+
* @param KRB5CCache $ccache
32+
* @return void
33+
*/
34+
public function getDelegatedCredentials(KRB5CCache $ccache)
35+
{
36+
}
37+
}
38+
39+
40+
class KRB5CCache
41+
{
42+
/**
43+
*
44+
*/
45+
public function __construct()
46+
{
47+
}
48+
49+
50+
/**
51+
* @return string
52+
*/
53+
public function getName()
54+
{
55+
}
56+
57+
58+
/**
59+
* @param string $src
60+
* @return bool
61+
*/
62+
public function open($src)
63+
{
64+
}
65+
66+
67+
/**
68+
* @param string $dest
69+
* @return bool
70+
*/
71+
public function save($dest)
72+
{
73+
}
74+
75+
76+
/**
77+
* @param string $principal
78+
* @param string $pass
79+
* @param array|null $options
80+
* @return bool
81+
*/
82+
public function initPassword($principal, $pass, $options = null)
83+
{
84+
}
85+
86+
87+
/**
88+
* @param string $principal
89+
* @param string $keytab_file
90+
* @param array|null $options
91+
* @return bool
92+
*/
93+
public function initKeytab($principal, $keytab_file, $options = null)
94+
{
95+
}
96+
97+
98+
/**
99+
* @return string
100+
*/
101+
public function getPrincipal()
102+
{
103+
}
104+
105+
106+
/**
107+
* @return string
108+
*/
109+
public function getRealm()
110+
{
111+
}
112+
113+
114+
/**
115+
* @return array
116+
*/
117+
public function getLifetime()
118+
{
119+
}
120+
121+
122+
/**
123+
* @return array
124+
*/
125+
public function getEntries()
126+
{
127+
}
128+
129+
130+
/**
131+
* @param int $timeRemain
132+
* @return bool
133+
*/
134+
public function isValid($timeRemain = 0)
135+
{
136+
}
137+
138+
139+
/**
140+
* @param string|null $prefix
141+
* @return array
142+
*/
143+
public function getTktAttrs($prefix = null)
144+
{
145+
}
146+
147+
148+
/**
149+
* @return bool
150+
*/
151+
public function renew()
152+
{
153+
}
154+
155+
156+
/**
157+
* @param string $principal
158+
* @param string $oldpass
159+
* @param string $newpass
160+
* @return bool
161+
*/
162+
public function changePassword($principal, $oldpass, $newpass)
163+
{
164+
}
165+
166+
167+
/**
168+
* @return array
169+
*/
170+
public function getExpirationTime()
171+
{
172+
}
173+
}

0 commit comments

Comments
 (0)