Skip to content

Commit 77ed351

Browse files
monkeyiqtvdijen
andauthored
A hook to generate metadata (#20)
* A hook to generate metadata * Fix coding style & strict comparison --------- Co-authored-by: Tim van Dijen <tvdijen@gmail.com>
1 parent 4fd52de commit 77ed351

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

hooks/hook_generate_metadata.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use SimpleSAML\Assert\Assert;
6+
use SimpleSAML\SAML2\Constants as C;
7+
use SimpleSAML\{Configuration, Utils, Logger, Module};
8+
use SimpleSAML\Locale\Translate;
9+
use SimpleSAML\Metadata\MetaDataStorageHandler;
10+
11+
function adfs_hook_generate_metadata(array &$hookinfo): void
12+
{
13+
if ($hookinfo['set'] === 'adfs-idp-hosted') {
14+
$property = $hookinfo['property'];
15+
$endpoint = Module::getModuleURL('adfs/idp/prp.php');
16+
17+
switch ($property) {
18+
case 'SingleSignOnService':
19+
$hookinfo['result'] = $endpoint;
20+
break;
21+
case 'SingleSignOnServiceBinding':
22+
$hookinfo['result'] = C::BINDING_HTTP_REDIRECT;
23+
break;
24+
case 'SingleLogoutService':
25+
$hookinfo['result'] = $endpoint;
26+
break;
27+
case 'SingleLogoutServiceBinding':
28+
$hookinfo['result'] = C::BINDING_HTTP_REDIRECT;
29+
break;
30+
}
31+
}
32+
}
33+

0 commit comments

Comments
 (0)