|
7 | 7 | use DateInterval; |
8 | 8 | use SimpleSAML\Locale\Translate; |
9 | 9 | use SimpleSAML\Module\oidc\Codebooks\ConfigOverviewValueTypeEnum; |
| 10 | +use SimpleSAML\Module\oidc\Codebooks\VciCredentialBindingPolicyEnum; |
10 | 11 | use SimpleSAML\Module\oidc\ModuleConfig; |
11 | 12 | use SimpleSAML\Module\oidc\StatusList\Values\StatusListPool; |
12 | 13 | use SimpleSAML\Module\oidc\StatusList\Values\StatusListPoolBag; |
@@ -557,6 +558,51 @@ protected function buildCredentialConfigurationsSection(): Section |
557 | 558 | ) : null, |
558 | 559 | $error, |
559 | 560 | ), |
| 561 | + $this->guardRow( |
| 562 | + Translate::noop('Credential Binding Policies'), |
| 563 | + ModuleConfig::OPTION_VCI_CREDENTIAL_BINDING_POLICIES, |
| 564 | + function (): Row { |
| 565 | + // Only the exceptions are listed. Requiring a key proof is the default, so naming |
| 566 | + // every configuration which does would bury the ones which do not, and it is those |
| 567 | + // an administrator needs to recognise on sight. |
| 568 | + $proofless = array_keys( |
| 569 | + array_filter( |
| 570 | + $this->moduleConfig->getVciCredentialBindingPolicies(), |
| 571 | + $this->isProofless(...), |
| 572 | + ), |
| 573 | + ); |
| 574 | + |
| 575 | + if ($proofless === []) { |
| 576 | + return new Row( |
| 577 | + Translate::noop('Credential Binding Policies'), |
| 578 | + Translate::noop('Every configuration requires a key proof'), |
| 579 | + ConfigOverviewValueTypeEnum::Text, |
| 580 | + ModuleConfig::OPTION_VCI_CREDENTIAL_BINDING_POLICIES, |
| 581 | + Translate::noop( |
| 582 | + 'Every credential configuration binds its credentials to a key the ' . |
| 583 | + 'wallet proves it holds, which is the default. Each one advertises ' . |
| 584 | + 'the binding methods and proof types it accepts, and a Credential ' . |
| 585 | + 'Request carrying no valid key proof is refused.', |
| 586 | + ), |
| 587 | + ); |
| 588 | + } |
| 589 | + |
| 590 | + return new Row( |
| 591 | + Translate::noop('Credential Binding Policies'), |
| 592 | + $proofless, |
| 593 | + ConfigOverviewValueTypeEnum::StringList, |
| 594 | + ModuleConfig::OPTION_VCI_CREDENTIAL_BINDING_POLICIES, |
| 595 | + null, |
| 596 | + Translate::noop( |
| 597 | + 'These credential configurations issue credentials which are not bound ' . |
| 598 | + 'to any wallet key, so nothing ties an issued credential to whoever ' . |
| 599 | + 'presents it later. They advertise no binding methods and no proof ' . |
| 600 | + 'types, and a key proof sent to them is refused. Configurations which ' . |
| 601 | + 'are not listed require a key proof.', |
| 602 | + ), |
| 603 | + ); |
| 604 | + }, |
| 605 | + ), |
560 | 606 | new Row( |
561 | 607 | Translate::noop('Attribute to Claim Path Mappings'), |
562 | 608 | $attributeMap, |
@@ -1007,6 +1053,15 @@ protected function normalizeRedirectUriPrefix(mixed $prefix): ?string |
1007 | 1053 | } |
1008 | 1054 |
|
1009 | 1055 |
|
| 1056 | + /** |
| 1057 | + * Whether a credential configuration issues credentials which are not bound to a holder key. |
| 1058 | + */ |
| 1059 | + protected function isProofless(VciCredentialBindingPolicyEnum $bindingPolicy): bool |
| 1060 | + { |
| 1061 | + return $bindingPolicy === VciCredentialBindingPolicyEnum::Proofless; |
| 1062 | + } |
| 1063 | + |
| 1064 | + |
1010 | 1065 | /** |
1011 | 1066 | * Whether any credential configuration declares a format which cannot be issued. |
1012 | 1067 | */ |
|
0 commit comments