Skip to content

Commit c90e61d

Browse files
committed
Fix terminology; active/passive auth was switched
1 parent e5bde46 commit c90e61d

4 files changed

Lines changed: 29 additions & 29 deletions

File tree

phpstan-baseline.neon

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: '#^Parameter \#1 \$idp of class SimpleSAML\\IdP\\IFrameLogoutHandler constructor expects SimpleSAML\\IdP, \$this\(SimpleSAML\\Module\\adfs\\IdP\\PassiveIdP\) given\.$#'
4+
message: '#^Parameter \#1 \$idp of class SimpleSAML\\IdP\\IFrameLogoutHandler constructor expects SimpleSAML\\IdP, \$this\(SimpleSAML\\Module\\adfs\\IdP\\ActiveIdP\) given\.$#'
55
identifier: argument.type
66
count: 1
7-
path: src/IdP/PassiveIdP.php
7+
path: src/IdP/ActiveIdP.php
88

99
-
10-
message: '#^Parameter \#1 \$idp of class SimpleSAML\\IdP\\TraditionalLogoutHandler constructor expects SimpleSAML\\IdP, \$this\(SimpleSAML\\Module\\adfs\\IdP\\PassiveIdP\) given\.$#'
10+
message: '#^Parameter \#1 \$idp of class SimpleSAML\\IdP\\TraditionalLogoutHandler constructor expects SimpleSAML\\IdP, \$this\(SimpleSAML\\Module\\adfs\\IdP\\ActiveIdP\) given\.$#'
1111
identifier: argument.type
1212
count: 1
13-
path: src/IdP/PassiveIdP.php
13+
path: src/IdP/ActiveIdP.php

src/Controller/Adfs.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use SimpleSAML\IdP;
1111
use SimpleSAML\Logger;
1212
use SimpleSAML\Metadata;
13+
use SimpleSAML\Module\adfs\IdP\ActiveIdP;
1314
use SimpleSAML\Module\adfs\IdP\ADFS as ADFS_IDP;
1415
use SimpleSAML\Module\adfs\IdP\MetadataBuilder;
15-
use SimpleSAML\Module\adfs\IdP\PassiveIdP;
1616
use SimpleSAML\Module\adfs\MetadataExchange;
1717
use SimpleSAML\Session;
1818
use SimpleSAML\SOAP12\XML\Envelope;
@@ -128,7 +128,7 @@ function () use ($idp) {
128128
},
129129
);
130130
} elseif ($wa === 'wsignin1.0') {
131-
return ADFS_IDP::receiveAuthnRequest($request, $idp);
131+
return ADFS_IDP::receivePassiveAuthnRequest($request, $idp);
132132
}
133133
throw new SspError\BadRequest("Unsupported value for 'wa' specified in request.");
134134
} elseif ($request->get('assocId', null) !== null) {
@@ -237,8 +237,8 @@ public function usernamemixed(Request $request): Response
237237
$soapEnvelope = Envelope::fromXML($domDocument->documentElement);
238238

239239
$idpEntityId = $this->metadata->getMetaDataCurrentEntityID('adfs-idp-hosted');
240-
$idp = PassiveIdP::getById($this->config, 'adfs:' . $idpEntityId);
240+
$idp = ActiveIdP::getById($this->config, 'adfs:' . $idpEntityId);
241241

242-
return ADFS_IDP::receivePassiveAuthnRequest($request, $soapEnvelope, $idp);
242+
return ADFS_IDP::receiveActiveAuthnRequest($request, $soapEnvelope, $idp);
243243
}
244244
}

src/IdP/ADFS.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ class ADFS
8989
/**
9090
* @param \Symfony\Component\HttpFoundation\Request $request
9191
* @param \SimpleSAML\SOAP12\XML\Envelope $soapEnvelope
92-
* @param \SimpleSAML\Module\adfs\IdP\PassiveIdP $idp
92+
* @param \SimpleSAML\Module\adfs\IdP\ActiveIdP $idp
9393
* @throws \SimpleSAML\Error\MetadataNotFound
9494
*/
95-
public static function receivePassiveAuthnRequest(
95+
public static function receiveActiveAuthnRequest(
9696
Request $request,
9797
Envelope $soapEnvelope,
98-
PassiveIdP $idp,
98+
ActiveIdP $idp,
9999
): StreamedResponse {
100100
// Parse the SOAP-header
101101
$header = $soapEnvelope->getHeader();
@@ -162,7 +162,7 @@ public static function receivePassiveAuthnRequest(
162162
Logger::debug($requestSecurityTokenStr);
163163

164164
$state = [
165-
'Responder' => [ADFS::class, 'sendPassiveResponse'],
165+
'Responder' => [ADFS::class, 'sendActiveResponse'],
166166
'SPMetadata' => $spMetadata->toArray(),
167167
'MessageID' => $messageid->getContent()->getValue(),
168168
// Dirty hack to leverage the SAML ECP logics
@@ -182,7 +182,7 @@ function () use ($idp, &$state) {
182182
* @param \SimpleSAML\IdP $idp
183183
* @throws \SimpleSAML\Error\MetadataNotFound
184184
*/
185-
public static function receiveAuthnRequest(Request $request, IdP $idp): StreamedResponse
185+
public static function receivePassiveAuthnRequest(Request $request, IdP $idp): StreamedResponse
186186
{
187187
parse_str($request->server->get('QUERY_STRING'), $query);
188188

@@ -243,7 +243,7 @@ function () use ($idp, &$state) {
243243
* @param string $method
244244
* @return \SimpleSAML\SAML11\XML\saml\Assertion
245245
*/
246-
private static function generateActiveAssertion(
246+
private static function generatePassiveAssertion(
247247
string $issuer,
248248
string $target,
249249
string $nameid,
@@ -328,7 +328,7 @@ private static function generateActiveAssertion(
328328
* @param int $assertionLifetime
329329
* @return \SimpleSAML\SAML11\XML\saml\Assertion
330330
*/
331-
private static function generatePassiveAssertion(
331+
private static function generateActiveAssertion(
332332
string $issuer,
333333
string $target,
334334
string $nameid,
@@ -637,7 +637,7 @@ public static function getHostedMetadata(string $entityid, ?MetaDataStorageHandl
637637
* @param array<mixed> $state
638638
* @throws \Exception
639639
*/
640-
public static function sendPassiveResponse(array $state): void
640+
public static function sendActiveResponse(array $state): void
641641
{
642642
$idp = IdP::getByState($state);
643643
$idpMetadata = $idp->getConfig();
@@ -662,7 +662,7 @@ public static function sendPassiveResponse(array $state): void
662662
$attributes = $state['Attributes'];
663663
$nameid = $state['saml:NameID'][C_SAML2::NAMEID_UNSPECIFIED];
664664

665-
$assertion = ADFS::generatePassiveAssertion(
665+
$assertion = ADFS::generateActiveAssertion(
666666
$idpEntityId,
667667
$spEntityId,
668668
$nameid->getValue(),
@@ -763,7 +763,7 @@ public static function sendPassiveResponse(array $state): void
763763
* @param array<mixed> $state
764764
* @throws \Exception
765765
*/
766-
public static function sendResponse(array $state): void
766+
public static function sendPassiveResponse(array $state): void
767767
{
768768
$spMetadata = $state['SPMetadata'];
769769
$spEntityId = $spMetadata['entityid'];
@@ -808,7 +808,7 @@ public static function sendResponse(array $state): void
808808
$method = C_SAML2::AC_PASSWORD;
809809
}
810810

811-
$assertion = ADFS::generateActiveAssertion(
811+
$assertion = ADFS::generatePassiveAssertion(
812812
$idpEntityId,
813813
$spEntityId,
814814
$nameid,
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
* @package simplesamlphp/simplesamlphp-module-adfs
3030
*/
3131

32-
class PassiveIdP
32+
class ActiveIdP
3333
{
3434
/**
3535
* A cache for resolving IdP id's.
3636
*
37-
* @var \SimpleSAML\Module\adfs\IdP\PassiveIdP[]
37+
* @var \SimpleSAML\Module\adfs\IdP\ActiveIdP[]
3838
*/
3939
private static array $idpCache = [];
4040

@@ -91,7 +91,7 @@ private function __construct(Configuration $config, string $id)
9191
throw new Exception("Protocol not implemented.");
9292
}
9393

94-
$auth = $this->config->getString('passiveAuth');
94+
$auth = $this->config->getString('activeAuth');
9595
if (Auth\Source::getById($auth) !== null) {
9696
$this->authSource = new Auth\Simple($auth);
9797
} else {
@@ -117,9 +117,9 @@ public function getId(): string
117117
* @param \SimpleSAML\Configuration $config The Configuration
118118
* @param string $id The identifier of the IdP.
119119
*
120-
* @return \SimpleSAML\Module\adfs\IdP\PassiveIdP The IdP.
120+
* @return \SimpleSAML\Module\adfs\IdP\ActiveIdP The IdP.
121121
*/
122-
public static function getById(Configuration $config, string $id): PassiveIdP
122+
public static function getById(Configuration $config, string $id): ActiveIdP
123123
{
124124
if (isset(self::$idpCache[$id])) {
125125
return self::$idpCache[$id];
@@ -137,9 +137,9 @@ public static function getById(Configuration $config, string $id): PassiveIdP
137137
* @param \SimpleSAML\Configuration $config The Configuration.
138138
* @param array<mixed> &$state The state array.
139139
*
140-
* @return \SimpleSAML\Module\adfs\IdP\PassiveIdP The IdP.
140+
* @return \SimpleSAML\Module\adfs\IdP\ActiveIdP The IdP.
141141
*/
142-
public static function getByState(Configuration $config, array &$state): PassiveIdP
142+
public static function getByState(Configuration $config, array &$state): ActiveIdP
143143
{
144144
Assert::notNull($state['core:IdP']);
145145

@@ -202,7 +202,7 @@ public static function postAuthProc(array $state): void
202202
*/
203203
public static function postAuth(array $state): void
204204
{
205-
$idp = PassiveIdP::getByState(Configuration::getInstance(), $state);
205+
$idp = ActiveIdP::getByState(Configuration::getInstance(), $state);
206206

207207
if (!$idp->isAuthenticated()) {
208208
throw new Error\Exception('Not authenticated.');
@@ -228,7 +228,7 @@ public static function postAuth(array $state): void
228228

229229
$pc = new Auth\ProcessingChain($idpMetadata, $spMetadata, 'idp');
230230

231-
$state['ReturnCall'] = ['\SimpleSAML\Module\adfs\IdP\PassiveIdP', 'postAuthProc'];
231+
$state['ReturnCall'] = ['\SimpleSAML\Module\adfs\IdP\ActiveIdP', 'postAuthProc'];
232232
$state['Destination'] = $spMetadata;
233233
$state['Source'] = $idpMetadata;
234234

@@ -272,7 +272,7 @@ public function handleAuthenticationRequest(array &$state): Response
272272

273273
$state['core:SP'] = $spEntityId;
274274
$state['IdPMetadata'] = $this->getConfig()->toArray();
275-
$state['ReturnCallback'] = ['\SimpleSAML\Module\adfs\IdP\PassiveIdP', 'postAuth'];
275+
$state['ReturnCallback'] = ['\SimpleSAML\Module\adfs\IdP\ActiveIdP', 'postAuth'];
276276

277277
try {
278278
$this->authenticate($state);

0 commit comments

Comments
 (0)