Skip to content

Commit

Permalink
Add trailing commas
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed May 18, 2024
1 parent 62686be commit 8aa9aaf
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 97 deletions.
2 changes: 1 addition & 1 deletion public/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
'userName' => $mappedAttributes['user'],
'attributes' => $mappedAttributes['attributes'],
'proxies' => [],
'sessionId' => $sessionTicket['id']
'sessionId' => $sessionTicket['id'],
]);

$ticketStore->addTicket($serviceTicket);
Expand Down
2 changes: 1 addition & 1 deletion public/proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'forceAuthn' => $proxyGrantingTicket['forceAuthn'],
'attributes' => $proxyGrantingTicket['attributes'],
'proxies' => $proxyGrantingTicket['proxies'],
'sessionId' => $proxyGrantingTicket['sessionId']
'sessionId' => $proxyGrantingTicket['sessionId'],
]
);

Expand Down
2 changes: 1 addition & 1 deletion public/utility/validateTicket.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
'attributes' => $attributes,
'forceAuthn' => false,
'proxies' => array_merge([$serviceUrl], $serviceTicket['proxies']),
'sessionId' => $serviceTicket['sessionId']
'sessionId' => $serviceTicket['sessionId'],
]);
$httpUtils = new Utils\HTTP();
try {
Expand Down
4 changes: 2 additions & 2 deletions src/Cas/AttributeExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function extractUserAndAttributes(array $attributes, Configuration $casco

return [
'user' => $userName,
'attributes' => $casAttributes
'attributes' => $casAttributes,
];
}

Expand All @@ -79,7 +79,7 @@ private function invokeAuthProc(array $attributes, Configuration $casconfig): ar
$filters = $casconfig->getOptionalArray('authproc', []);

$state = [
'Attributes' => $attributes
'Attributes' => $attributes,
];
foreach ($filters as $config) {
$className = Module::resolveClass(
Expand Down
2 changes: 1 addition & 1 deletion src/Cas/Protocol/SamlValidateResponder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function convertToSaml(array $ticket): Chunk
$ar = new AuthnResponse();
$idpMetadata = [
// CAS doesn't seem to care what this is, however SSP code requires it to be set
'entityid' => 'localhost'
'entityid' => 'localhost',
];
$spMetadata = [
'entityid' => $serviceUrl,
Expand Down
4 changes: 2 additions & 2 deletions src/Cas/Ticket/SQLTicketStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ private function setTableVersion(string $name, int $version): void
['_name'],
[
'_name' => $name,
'_version' => $version
]
'_version' => $version,
],
);
$this->tableVersions[$name] = $version;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cas/Ticket/TicketFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function createSessionTicket(string $sessionId, int $expiresAt): array
return [
'id' => $sessionId,
'validBefore' => $expiresAt,
'renewId' => $randomUtils->generateID()
'renewId' => $randomUtils->generateID(),
];
}

Expand Down
8 changes: 4 additions & 4 deletions tests/config/module_casserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
'scopes' => [
'mobile' => [
'https://idp1.domain:1234/saml2/idp/metadata.php',
'https://idp2.domain:5678/saml2/idp/metadata.php'
'https://idp2.domain:5678/saml2/idp/metadata.php',
],
'desktop' => [
'https://idp3.domain:1234/saml2/idp/metadata.php',
'https://idp4.domain:5678/saml2/idp/metadata.php'
]
'https://idp4.domain:5678/saml2/idp/metadata.php',
],
],

'legal_service_urls' => [
Expand All @@ -33,7 +33,7 @@
],
'http:https://changeTicketParam' => [
'ticketName' => 'myTicket',
]
],
],

'legal_target_service_urls' => [
Expand Down
72 changes: 36 additions & 36 deletions tests/public/LoginIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function setup(): void

'module.enable' => [
'casserver' => true,
]
],
]);
}

Expand Down Expand Up @@ -124,8 +124,8 @@ public function testNoQueryParameters(): void
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file,
CURLOPT_FOLLOWLOCATION => true
]
CURLOPT_FOLLOWLOCATION => true,
],
);
$this->assertEquals(200, $resp['code']);

Check failure on line 130 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.3, ubuntu-latest

Failed asserting that 404 matches expected 200.

Check failure on line 130 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.1, ubuntu-latest

Failed asserting that 404 matches expected 200.

Check failure on line 130 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.2, windows-latest

Failed asserting that 404 matches expected 200.

Expand All @@ -148,15 +148,15 @@ public function testWrongServiceUrl(): void
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file,
CURLOPT_FOLLOWLOCATION => true
]
CURLOPT_FOLLOWLOCATION => true,
],
);
$this->assertEquals(500, $resp['code']);

Check failure on line 154 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.3, ubuntu-latest

Failed asserting that 404 matches expected 500.

Check failure on line 154 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.1, ubuntu-latest

Failed asserting that 404 matches expected 500.

Check failure on line 154 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.2, ubuntu-latest

Failed asserting that 404 matches expected 500.

Check failure on line 154 in tests/public/LoginIntegrationTest.php

View workflow job for this annotation

GitHub Actions / Unit tests, PHP 8.2, windows-latest

Failed asserting that 404 matches expected 500.

$this->assertStringContainsString(
'CAS server is not listed as a legal service',
$resp['body'],
'Illegal cas service urls should be rejected'
'Illegal cas service urls should be rejected',
);
}

Expand All @@ -178,15 +178,15 @@ public function testValidServiceUrl(string $serviceParam, string $ticketParam):
[$serviceParam => $service_url],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);
$this->assertEquals(303, $resp['code']);

$this->assertStringStartsWith(
$service_url . '?' . $ticketParam . '=ST-',
$resp['headers']['Location'],
'Ticket should be part of the redirect.'
'Ticket should be part of the redirect.',
);

// Config ticket can be validated
Expand All @@ -198,11 +198,11 @@ public function testValidServiceUrl(string $serviceParam, string $ticketParam):
[
$serviceParam => $service_url,
'ticket' => $ticket,
],
],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);

$expectedResponse = DOMDocumentFactory::fromFile(
Expand All @@ -217,7 +217,7 @@ public function validServiceUrlProvider(): array
{
return [
['service', 'ticket'],
['TARGET', 'SAMLart']
['TARGET', 'SAMLart'],
];
}

Expand All @@ -235,15 +235,15 @@ public function testValidTicketNameOverride(): void
['TARGET' => $service_url],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);
$this->assertEquals(303, $resp['code']);

$this->assertStringStartsWith(
$service_url . '?myTicket=ST-',
$resp['headers']['Location'],
'Ticket should be part of the redirect.'
'Ticket should be part of the redirect.',
);
}

Expand All @@ -260,15 +260,15 @@ public function testDebugOutput(): void
['service' => $service_url, 'debugMode' => 'true'],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);
$this->assertEquals(200, $resp['code']);

$this->assertStringContainsString(
'<cas:eduPersonPrincipalName>[email protected]</cas:eduPersonPrincipalName>',
$resp['body'],
'Attributes should have been printed.'
'Attributes should have been printed.',
);
}

Expand All @@ -285,16 +285,16 @@ public function testDebugOutputSamlValidate(): void
['service' => $service_url, 'debugMode' => 'samlValidate'],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);
$this->assertEquals(200, $resp['code']);


$this->assertStringContainsString(
'[email protected]</NameIdentifier',
$resp['body'],
'Attributes should have been printed.'
'Attributes should have been printed.',
);
}

Expand All @@ -311,19 +311,19 @@ public function testAlternateServiceConfigUsed(): void
['service' => $service_url, 'debugMode' => 'true'],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);
$this->assertEquals(200, $resp['code']);
$this->assertStringContainsString(
'<cas:user>testuser</cas:user>',
$resp['body'],
'cas:user attribute should have been overridden'
'cas:user attribute should have been overridden',
);
$this->assertStringContainsString(
'<cas:cn>Test User</cas:cn>',
$resp['body'],
'Attributes should have been printed with alternate attribute release'
'Attributes should have been printed with alternate attribute release',
);
}

Expand All @@ -344,8 +344,8 @@ public function testValidServiceUrlWithPost(): void
],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);

// POST responds with a form that is uses JavaScript to submit
Expand All @@ -372,12 +372,12 @@ public function testValidServiceUrlWithPost(): void
}
$this->assertEquals(
'ticket',
$item->getAttribute('name')
$item->getAttribute('name'),
);
$this->assertStringStartsWith(
'ST-',
$item->getAttribute('value'),
''
'',
);
}

Expand All @@ -394,15 +394,15 @@ public function testSamlValidate(): void
['service' => $service_url],
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file
]
CURLOPT_COOKIEFILE => $this->cookies_file,
],
);
$this->assertEquals(303, $resp['code']);

$this->assertStringStartsWith(
$service_url . '?ticket=ST-',
$resp['headers']['Location'],
'Ticket should be part of the redirect.'
'Ticket should be part of the redirect.',
);

$location = $resp['headers']['Location'];
Expand All @@ -425,7 +425,7 @@ public function testSamlValidate(): void
$soapRequest,
[
'TARGET' => $service_url,
]
],
);

$this->assertEquals(200, $resp['code']);
Expand All @@ -445,8 +445,8 @@ private function authenticate(): void
[
CURLOPT_COOKIEJAR => $this->cookies_file,
CURLOPT_COOKIEFILE => $this->cookies_file,
CURLOPT_FOLLOWLOCATION => true
]
CURLOPT_FOLLOWLOCATION => true,
],
);
$this->assertEquals(200, $resp['code'], $resp['body']);
}
Expand Down
Loading

0 comments on commit 8aa9aaf

Please sign in to comment.