Skip to content

Commit 20419a3

Browse files
committed
Merge with wip-version-7
2 parents 1f1da59 + e779e59 commit 20419a3

File tree

5 files changed

+59
-2
lines changed

5 files changed

+59
-2
lines changed

config/module_oidc.php.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,13 @@ $config = [
422422
],
423423
],
424424

425+
// (optional) Trust Mark Status Endpoint Usage Policy. Check the TrustMarkStatusEndpointUsagePolicyEnum for the
426+
// available options. Default is RequiredIfEndpointProvidedForNonExpiringTrustMarksOnly, meaning that the
427+
// Trust Mark Status Endpoint will be used to check the status of non-expiring Trust Marks if the
428+
// Trust Mark Status Endpoint is provided by the Trust Mark Issuer.
429+
ModuleConfig::OPTION_FEDERATION_TRUST_MARK_STATUS_ENDPOINT_USAGE_POLICY =>
430+
\SimpleSAML\OpenID\Codebooks\TrustMarkStatusEndpointUsagePolicyEnum::RequiredIfEndpointProvidedForNonExpiringTrustMarksOnly,
431+
425432
// (optional) Dedicated federation cache adapter, used to cache federation artifacts like trust chains, entity
426433
// statements, etc. It will also be used for token reuse check in federation context. Setting this option is
427434
// recommended in production environments. If set to null, no caching will be used. Can be set to any

docs/6-oidc-upgrade.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ capabilities are to be used):
9696
statements
9797
- federation participation limiting based on Trust Marks for RPs
9898
- (from v6.1) own Trust Marks to dynamically fetch
99+
- (from v6.3) Trust Mark Status Endpoint Usage Policy
99100
- signer algorithm
100101
- entity statement duration
101102
- organization name
@@ -153,6 +154,13 @@ menu in the Administration area.
153154
`config-templates/module_oidc.php` to `config/module_oidc.php.dist`.
154155
This is only relevant for new installations, since initially it is necessary
155156
to copy the template file to the default SSP config dir.
157+
- (from v6.3) A new option for Trust Mark Status Endpoint Usage Policy has
158+
been introduced, which can be used to control how the Trust Mark Status
159+
Endpoint is used when validating Trust Marks. The default value is
160+
`RequiredIfEndpointProvidedForNonExpiringTrustMarksOnly`, which
161+
means that the Trust Mark Status Endpoint is only used if the
162+
endpoint is provided by the Trust Mark Issuer, and the Trust
163+
Mark does not expire.
156164

157165
Below are also some internal changes that should not have an impact on the
158166
OIDC OP implementers. However, if you are using this module as a library or

src/Factories/FederationFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public function build(): Federation
4646
maxCacheDuration: $this->moduleConfig->getFederationCacheMaxDurationForFetched(),
4747
cache: $this->federationCache?->cache,
4848
logger: $this->loggerService,
49+
defaultTrustMarkStatusEndpointUsagePolicyEnum:
50+
$this->moduleConfig->getFederationTrustMarkStatusEndpointUsagePolicy(),
4951
);
5052
}
5153
}

src/ModuleConfig.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
2727
use SimpleSAML\OpenID\Codebooks\ClaimsEnum;
2828
use SimpleSAML\OpenID\Codebooks\ScopesEnum;
29+
use SimpleSAML\OpenID\Codebooks\TrustMarkStatusEndpointUsagePolicyEnum;
2930

3031
class ModuleConfig
3132
{
@@ -83,14 +84,16 @@ class ModuleConfig
8384
final public const OPTION_FEDERATION_TRUST_ANCHORS = 'federation_trust_anchors';
8485
final public const OPTION_FEDERATION_TRUST_MARK_TOKENS = 'federation_trust_mark_tokens';
8586
final public const OPTION_FEDERATION_DYNAMIC_TRUST_MARKS = 'federation_dynamic_trust_mark_tokens';
87+
final public const OPTION_FEDERATION_PARTICIPATION_LIMIT_BY_TRUST_MARKS =
88+
'federation_participation_limit_by_trust_marks';
89+
final public const OPTION_FEDERATION_TRUST_MARK_STATUS_ENDPOINT_USAGE_POLICY =
90+
'federation_trust_mark_status_endpoint_usage_policy';
8691
final public const OPTION_FEDERATION_CACHE_DURATION_FOR_PRODUCED = 'federation_cache_duration_for_produced';
8792
final public const OPTION_PROTOCOL_CACHE_ADAPTER = 'protocol_cache_adapter';
8893
final public const OPTION_PROTOCOL_CACHE_ADAPTER_ARGUMENTS = 'protocol_cache_adapter_arguments';
8994
final public const OPTION_PROTOCOL_USER_ENTITY_CACHE_DURATION = 'protocol_user_entity_cache_duration';
9095
final public const OPTION_PROTOCOL_CLIENT_ENTITY_CACHE_DURATION = 'protocol_client_entity_cache_duration';
9196
final public const OPTION_PROTOCOL_DISCOVERY_SHOW_CLAIMS_SUPPORTED = 'protocol_discover_show_claims_supported';
92-
final public const OPTION_FEDERATION_PARTICIPATION_LIMIT_BY_TRUST_MARKS =
93-
'federation_participation_limit_by_trust_marks';
9497

9598
final public const OPTION_PKI_NEW_PRIVATE_KEY_PASSPHRASE = 'new_private_key_passphrase';
9699
final public const OPTION_PKI_NEW_PRIVATE_KEY_FILENAME = 'new_privatekey';
@@ -839,6 +842,21 @@ public function getFederationParticipationLimitByTrustMarks(): array
839842
);
840843
}
841844

845+
public function getFederationTrustMarkStatusEndpointUsagePolicy(): TrustMarkStatusEndpointUsagePolicyEnum
846+
{
847+
/** @psalm-suppress MixedAssignment */
848+
$policy = $this->config()->getOptionalValue(
849+
self::OPTION_FEDERATION_TRUST_MARK_STATUS_ENDPOINT_USAGE_POLICY,
850+
null,
851+
);
852+
853+
if ($policy instanceof TrustMarkStatusEndpointUsagePolicyEnum) {
854+
return $policy;
855+
}
856+
857+
return TrustMarkStatusEndpointUsagePolicyEnum::RequiredIfEndpointProvidedForNonExpiringTrustMarksOnly;
858+
}
859+
842860
/**
843861
* @throws \SimpleSAML\Error\ConfigurationError
844862
*/

tests/unit/src/ModuleConfigTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use SimpleSAML\Module\oidc\Bridges\SspBridge;
1616
use SimpleSAML\Module\oidc\ModuleConfig;
1717
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
18+
use SimpleSAML\OpenID\Codebooks\TrustMarkStatusEndpointUsagePolicyEnum;
1819
use SimpleSAML\Utils\Config;
1920
use SimpleSAML\Utils\HTTP;
2021
use stdClass;
@@ -476,4 +477,25 @@ public function testCanGetIsFederationParticipationLimitedByTrustMarksFor(): voi
476477
$this->sut()->isFederationParticipationLimitedByTrustMarksFor('https://ta.example.org/'),
477478
);
478479
}
480+
481+
public function testCanGetFederationTrustMarkStatusEndpointUsagePolicy(): void
482+
{
483+
// Assert default policy.
484+
$this->assertSame(
485+
TrustMarkStatusEndpointUsagePolicyEnum::RequiredIfEndpointProvidedForNonExpiringTrustMarksOnly,
486+
$this->sut()->getFederationTrustMarkStatusEndpointUsagePolicy(),
487+
);
488+
489+
// Assert custom configuration.
490+
$sut = $this->sut(
491+
overrides: [
492+
ModuleConfig::OPTION_FEDERATION_TRUST_MARK_STATUS_ENDPOINT_USAGE_POLICY =>
493+
TrustMarkStatusEndpointUsagePolicyEnum::Required,
494+
],
495+
);
496+
$this->assertSame(
497+
TrustMarkStatusEndpointUsagePolicyEnum::Required,
498+
$sut->getFederationTrustMarkStatusEndpointUsagePolicy(),
499+
);
500+
}
479501
}

0 commit comments

Comments
 (0)