@@ -88,10 +88,10 @@ |
||
88 | 88 | final public function serialize(): array |
89 | 89 | { |
90 | 90 | return [ |
91 | - 'identity_id' => (string)$this->identityId, |
|
92 | - 'identity_institution' => (string)$this->identityInstitution, |
|
93 | - 'recovery_token_id' => (string)$this->recoveryTokenId, |
|
94 | - 'recovery_token_type' => (string)$this->recoveryTokenType, |
|
91 | + 'identity_id' => (string) $this->identityId, |
|
92 | + 'identity_institution' => (string) $this->identityInstitution, |
|
93 | + 'recovery_token_id' => (string) $this->recoveryTokenId, |
|
94 | + 'recovery_token_type' => (string) $this->recoveryTokenType, |
|
95 | 95 | ]; |
96 | 96 | } |
97 | 97 |
@@ -95,11 +95,11 @@ |
||
95 | 95 | final public function serialize(): array |
96 | 96 | { |
97 | 97 | return [ |
98 | - 'identity_id' => (string)$this->identityId, |
|
99 | - 'identity_institution' => (string)$this->identityInstitution, |
|
100 | - 'recovery_token_id' => (string)$this->recoveryTokenId, |
|
101 | - 'recovery_token_type' => (string)$this->recoveryTokenType, |
|
102 | - 'authority_id' => (string)$this->authorityId, |
|
98 | + 'identity_id' => (string) $this->identityId, |
|
99 | + 'identity_institution' => (string) $this->identityInstitution, |
|
100 | + 'recovery_token_id' => (string) $this->recoveryTokenId, |
|
101 | + 'recovery_token_type' => (string) $this->recoveryTokenType, |
|
102 | + 'authority_id' => (string) $this->authorityId, |
|
103 | 103 | ]; |
104 | 104 | } |
105 | 105 |
@@ -122,7 +122,7 @@ |
||
122 | 122 | { |
123 | 123 | $institutions = []; |
124 | 124 | /** @var Institution $institution */ |
125 | - foreach($collection->jsonSerialize()['institutions'] as $institution) |
|
125 | + foreach ($collection->jsonSerialize()['institutions'] as $institution) |
|
126 | 126 | { |
127 | 127 | $institutions[] = $institution->getInstitution(); |
128 | 128 | } |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | use Surfnet\StepupMiddleware\Kernel; |
3 | 3 | |
4 | -require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; |
|
5 | -require_once dirname(__DIR__).'/config/bootstrap.php'; |
|
4 | +require_once dirname(__DIR__) . '/vendor/autoload_runtime.php'; |
|
5 | +require_once dirname(__DIR__) . '/config/bootstrap.php'; |
|
6 | 6 | |
7 | -return function (array $context) { |
|
7 | +return function(array $context) { |
|
8 | 8 | return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); |
9 | 9 | }; |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | use Symfony\Component\Yaml\Yaml; |
4 | 4 | |
5 | -require dirname(__DIR__).'/vendor/autoload.php'; |
|
6 | -$parametersPath = dirname(__DIR__).'/config/openconext/parameters.yaml'; |
|
5 | +require dirname(__DIR__) . '/vendor/autoload.php'; |
|
6 | +$parametersPath = dirname(__DIR__) . '/config/openconext/parameters.yaml'; |
|
7 | 7 | $parameters = Yaml::parseFile($parametersPath); |
8 | 8 | $parameters = $parameters['parameters']; |
9 | 9 | $requiredParameters = ['app_env', 'app_debug', 'app_secret']; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $recoveryToken = $this->recoveryTokens->get($recoveryTokenId); |
572 | 572 | } catch (DomainException) { |
573 | 573 | throw new DomainException( |
574 | - sprintf('Recovery token used during registration is not possessed by identity %s', (string)$this->id), |
|
574 | + sprintf('Recovery token used during registration is not possessed by identity %s', (string) $this->id), |
|
575 | 575 | ); |
576 | 576 | } |
577 | 577 | |
@@ -755,11 +755,11 @@ discard block |
||
755 | 755 | $this->assertNotForgotten(); |
756 | 756 | |
757 | 757 | /** @var UnverifiedSecondFactor|null $unverifiedSecondFactor */ |
758 | - $unverifiedSecondFactor = $this->unverifiedSecondFactors->get((string)$secondFactorId); |
|
758 | + $unverifiedSecondFactor = $this->unverifiedSecondFactors->get((string) $secondFactorId); |
|
759 | 759 | /** @var VerifiedSecondFactor|null $verifiedSecondFactor */ |
760 | - $verifiedSecondFactor = $this->verifiedSecondFactors->get((string)$secondFactorId); |
|
760 | + $verifiedSecondFactor = $this->verifiedSecondFactors->get((string) $secondFactorId); |
|
761 | 761 | /** @var VettedSecondFactor|null $vettedSecondFactor */ |
762 | - $vettedSecondFactor = $this->vettedSecondFactors->get((string)$secondFactorId); |
|
762 | + $vettedSecondFactor = $this->vettedSecondFactors->get((string) $secondFactorId); |
|
763 | 763 | |
764 | 764 | if (!$unverifiedSecondFactor && !$verifiedSecondFactor && !$vettedSecondFactor) { |
765 | 765 | throw new DomainException('Cannot revoke second factor: no second factor with given id exists.'); |
@@ -789,11 +789,11 @@ discard block |
||
789 | 789 | $this->assertNotForgotten(); |
790 | 790 | |
791 | 791 | /** @var UnverifiedSecondFactor|null $unverifiedSecondFactor */ |
792 | - $unverifiedSecondFactor = $this->unverifiedSecondFactors->get((string)$secondFactorId); |
|
792 | + $unverifiedSecondFactor = $this->unverifiedSecondFactors->get((string) $secondFactorId); |
|
793 | 793 | /** @var VerifiedSecondFactor|null $verifiedSecondFactor */ |
794 | - $verifiedSecondFactor = $this->verifiedSecondFactors->get((string)$secondFactorId); |
|
794 | + $verifiedSecondFactor = $this->verifiedSecondFactors->get((string) $secondFactorId); |
|
795 | 795 | /** @var VettedSecondFactor|null $vettedSecondFactor */ |
796 | - $vettedSecondFactor = $this->vettedSecondFactors->get((string)$secondFactorId); |
|
796 | + $vettedSecondFactor = $this->vettedSecondFactors->get((string) $secondFactorId); |
|
797 | 797 | |
798 | 798 | if (!$unverifiedSecondFactor && !$verifiedSecondFactor && !$vettedSecondFactor) { |
799 | 799 | throw new DomainException('Cannot revoke second factor: no second factor with given id exists.'); |
@@ -1059,7 +1059,7 @@ discard block |
||
1059 | 1059 | new UnknownVettingType(), |
1060 | 1060 | ); |
1061 | 1061 | |
1062 | - $this->vettedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1062 | + $this->vettedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | protected function applyYubikeyPossessionProvenEvent(YubikeyPossessionProvenEvent $event): void |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | $event->emailVerificationNonce, |
1074 | 1074 | ); |
1075 | 1075 | |
1076 | - $this->unverifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1076 | + $this->unverifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | protected function applyYubikeyPossessionProvenAndVerifiedEvent(YubikeyPossessionProvenAndVerifiedEvent $event): void |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | $event->registrationCode, |
1088 | 1088 | ); |
1089 | 1089 | |
1090 | - $this->verifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1090 | + $this->verifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | protected function applyPhonePossessionProvenEvent(PhonePossessionProvenEvent $event): void |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | $event->emailVerificationNonce, |
1102 | 1102 | ); |
1103 | 1103 | |
1104 | - $this->unverifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1104 | + $this->unverifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | protected function applyPhonePossessionProvenAndVerifiedEvent(PhonePossessionProvenAndVerifiedEvent $event): void |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | $event->registrationCode, |
1116 | 1116 | ); |
1117 | 1117 | |
1118 | - $this->verifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1118 | + $this->verifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | protected function applyGssfPossessionProvenEvent(GssfPossessionProvenEvent $event): void |
@@ -1123,13 +1123,13 @@ discard block |
||
1123 | 1123 | $secondFactor = UnverifiedSecondFactor::create( |
1124 | 1124 | $event->secondFactorId, |
1125 | 1125 | $this, |
1126 | - new SecondFactorType((string)$event->stepupProvider), |
|
1126 | + new SecondFactorType((string) $event->stepupProvider), |
|
1127 | 1127 | $event->gssfId, |
1128 | 1128 | $event->emailVerificationWindow, |
1129 | 1129 | $event->emailVerificationNonce, |
1130 | 1130 | ); |
1131 | 1131 | |
1132 | - $this->unverifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1132 | + $this->unverifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | protected function applyGssfPossessionProvenAndVerifiedEvent(GssfPossessionProvenAndVerifiedEvent $event): void |
@@ -1137,13 +1137,13 @@ discard block |
||
1137 | 1137 | $secondFactor = VerifiedSecondFactor::create( |
1138 | 1138 | $event->secondFactorId, |
1139 | 1139 | $this, |
1140 | - new SecondFactorType((string)$event->stepupProvider), |
|
1140 | + new SecondFactorType((string) $event->stepupProvider), |
|
1141 | 1141 | $event->gssfId, |
1142 | 1142 | $event->registrationRequestedAt, |
1143 | 1143 | $event->registrationCode, |
1144 | 1144 | ); |
1145 | 1145 | |
1146 | - $this->verifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1146 | + $this->verifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | protected function applyU2fDevicePossessionProvenEvent(U2fDevicePossessionProvenEvent $event): void |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | $event->emailVerificationNonce, |
1158 | 1158 | ); |
1159 | 1159 | |
1160 | - $this->unverifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1160 | + $this->unverifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | protected function applyU2fDevicePossessionProvenAndVerifiedEvent(U2fDevicePossessionProvenAndVerifiedEvent $event): void |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | $event->registrationCode, |
1172 | 1172 | ); |
1173 | 1173 | |
1174 | - $this->verifiedSecondFactors->set((string)$secondFactor->getId(), $secondFactor); |
|
1174 | + $this->verifiedSecondFactors->set((string) $secondFactor->getId(), $secondFactor); |
|
1175 | 1175 | } |
1176 | 1176 | |
1177 | 1177 | protected function applyPhoneRecoveryTokenPossessionProvenEvent(PhoneRecoveryTokenPossessionProvenEvent $event): void |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | protected function applyEmailVerifiedEvent(EmailVerifiedEvent $event): void |
1193 | 1193 | { |
1194 | - $secondFactorId = (string)$event->secondFactorId; |
|
1194 | + $secondFactorId = (string) $event->secondFactorId; |
|
1195 | 1195 | |
1196 | 1196 | /** @var UnverifiedSecondFactor $unverified */ |
1197 | 1197 | $unverified = $this->unverifiedSecondFactors->get($secondFactorId); |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | */ |
1209 | 1209 | public function applySecondFactorMigratedEvent(SecondFactorMigratedEvent $event): void |
1210 | 1210 | { |
1211 | - $secondFactorId = (string)$event->newSecondFactorId; |
|
1211 | + $secondFactorId = (string) $event->newSecondFactorId; |
|
1212 | 1212 | $vetted = VettedSecondFactor::create( |
1213 | 1213 | $event->newSecondFactorId, |
1214 | 1214 | $this, |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | protected function applySecondFactorVettedEvent(SecondFactorVettedEvent $event): void |
1223 | 1223 | { |
1224 | - $secondFactorId = (string)$event->secondFactorId; |
|
1224 | + $secondFactorId = (string) $event->secondFactorId; |
|
1225 | 1225 | $verified = $this->verifiedSecondFactors->get($secondFactorId); |
1226 | 1226 | $vetted = $verified->asVetted($event->vettingType); |
1227 | 1227 | $this->verifiedSecondFactors->remove($secondFactorId); |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | protected function applySecondFactorVettedWithoutTokenProofOfPossession( |
1232 | 1232 | SecondFactorVettedWithoutTokenProofOfPossession $event, |
1233 | 1233 | ): void { |
1234 | - $secondFactorId = (string)$event->secondFactorId; |
|
1234 | + $secondFactorId = (string) $event->secondFactorId; |
|
1235 | 1235 | |
1236 | 1236 | /** @var VerifiedSecondFactor $verified */ |
1237 | 1237 | $verified = $this->verifiedSecondFactors->get($secondFactorId); |
@@ -1243,35 +1243,35 @@ discard block |
||
1243 | 1243 | |
1244 | 1244 | protected function applyUnverifiedSecondFactorRevokedEvent(UnverifiedSecondFactorRevokedEvent $event): void |
1245 | 1245 | { |
1246 | - $this->unverifiedSecondFactors->remove((string)$event->secondFactorId); |
|
1246 | + $this->unverifiedSecondFactors->remove((string) $event->secondFactorId); |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | protected function applyCompliedWithUnverifiedSecondFactorRevocationEvent( |
1250 | 1250 | CompliedWithUnverifiedSecondFactorRevocationEvent $event, |
1251 | 1251 | ): void { |
1252 | - $this->unverifiedSecondFactors->remove((string)$event->secondFactorId); |
|
1252 | + $this->unverifiedSecondFactors->remove((string) $event->secondFactorId); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | protected function applyVerifiedSecondFactorRevokedEvent(VerifiedSecondFactorRevokedEvent $event): void |
1256 | 1256 | { |
1257 | - $this->verifiedSecondFactors->remove((string)$event->secondFactorId); |
|
1257 | + $this->verifiedSecondFactors->remove((string) $event->secondFactorId); |
|
1258 | 1258 | } |
1259 | 1259 | |
1260 | 1260 | protected function applyCompliedWithVerifiedSecondFactorRevocationEvent( |
1261 | 1261 | CompliedWithVerifiedSecondFactorRevocationEvent $event, |
1262 | 1262 | ): void { |
1263 | - $this->verifiedSecondFactors->remove((string)$event->secondFactorId); |
|
1263 | + $this->verifiedSecondFactors->remove((string) $event->secondFactorId); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | protected function applyVettedSecondFactorRevokedEvent(VettedSecondFactorRevokedEvent $event): void |
1267 | 1267 | { |
1268 | - $this->vettedSecondFactors->remove((string)$event->secondFactorId); |
|
1268 | + $this->vettedSecondFactors->remove((string) $event->secondFactorId); |
|
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | protected function applyCompliedWithVettedSecondFactorRevocationEvent( |
1272 | 1272 | CompliedWithVettedSecondFactorRevocationEvent $event, |
1273 | 1273 | ): void { |
1274 | - $this->vettedSecondFactors->remove((string)$event->secondFactorId); |
|
1274 | + $this->vettedSecondFactors->remove((string) $event->secondFactorId); |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | protected function applyCompliedWithRecoveryCodeRevocationEvent(CompliedWithRecoveryCodeRevocationEvent $event): void |
@@ -1469,7 +1469,7 @@ discard block |
||
1469 | 1469 | // Assert this token type is not yet registered |
1470 | 1470 | if ($this->recoveryTokens->hasType($recoveryTokenType)) { |
1471 | 1471 | throw new DomainException( |
1472 | - sprintf('Recovery token type %s is already registered', (string)$recoveryTokenType), |
|
1472 | + sprintf('Recovery token type %s is already registered', (string) $recoveryTokenType), |
|
1473 | 1473 | ); |
1474 | 1474 | } |
1475 | 1475 | } |
@@ -1512,12 +1512,12 @@ discard block |
||
1512 | 1512 | |
1513 | 1513 | public function getVerifiedSecondFactor(SecondFactorId $secondFactorId): ?VerifiedSecondFactor |
1514 | 1514 | { |
1515 | - return $this->verifiedSecondFactors->get((string)$secondFactorId); |
|
1515 | + return $this->verifiedSecondFactors->get((string) $secondFactorId); |
|
1516 | 1516 | } |
1517 | 1517 | |
1518 | 1518 | public function getVettedSecondFactorById(SecondFactorId $secondFactorId): ?VettedSecondFactor |
1519 | 1519 | { |
1520 | - return $this->vettedSecondFactors->get((string)$secondFactorId); |
|
1520 | + return $this->vettedSecondFactors->get((string) $secondFactorId); |
|
1521 | 1521 | } |
1522 | 1522 | |
1523 | 1523 | private function assertTokenNotAlreadyRegistered(SecondFactorType $type, SecondFactorIdentifier $identifier): void |
@@ -27,29 +27,29 @@ |
||
27 | 27 | |
28 | 28 | public function set(Institution $institution): void |
29 | 29 | { |
30 | - $this->institutions[(string)$institution] = $institution; |
|
30 | + $this->institutions[(string) $institution] = $institution; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function update(Institutions $institutions): void |
34 | 34 | { |
35 | 35 | foreach ($institutions as $institution) { |
36 | - $this->institutions[(string)$institution] = $institution; |
|
36 | + $this->institutions[(string) $institution] = $institution; |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function get(Institution $institution): Institution |
41 | 41 | { |
42 | - return $this->institutions[(string)$institution]; |
|
42 | + return $this->institutions[(string) $institution]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function exists(Institution $institution): bool |
46 | 46 | { |
47 | - return array_key_exists((string)$institution, $this->institutions); |
|
47 | + return array_key_exists((string) $institution, $this->institutions); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function remove(Institution $institution): void |
51 | 51 | { |
52 | - unset($this->institutions[(string)$institution]); |
|
52 | + unset($this->institutions[(string) $institution]); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function count(): int |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | |
32 | 32 | public function set(RecoveryToken $recoveryToken): void |
33 | 33 | { |
34 | - $this->recoveryTokens[(string)$recoveryToken->getTokenId()] = $recoveryToken; |
|
34 | + $this->recoveryTokens[(string) $recoveryToken->getTokenId()] = $recoveryToken; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function get(RecoveryTokenId $id): RecoveryToken |
38 | 38 | { |
39 | - if (!array_key_exists((string)$id, $this->recoveryTokens)) { |
|
39 | + if (!array_key_exists((string) $id, $this->recoveryTokens)) { |
|
40 | 40 | throw new DomainException(sprintf('Unable to find recovery token with id %s', $id)); |
41 | 41 | } |
42 | - return $this->recoveryTokens[(string)$id]; |
|
42 | + return $this->recoveryTokens[(string) $id]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function hasType(RecoveryTokenType $type): bool |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function remove(RecoveryTokenId $recoveryTokenId): void |
61 | 61 | { |
62 | - unset($this->recoveryTokens[(string)$recoveryTokenId]); |
|
62 | + unset($this->recoveryTokens[(string) $recoveryTokenId]); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function first(): RecoveryToken |
@@ -29,22 +29,22 @@ |
||
29 | 29 | |
30 | 30 | public function set(Institution $institution, RegistrationAuthority $registrationAuthority): void |
31 | 31 | { |
32 | - $this->registrationAuthorities[(string)$institution] = $registrationAuthority; |
|
32 | + $this->registrationAuthorities[(string) $institution] = $registrationAuthority; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function get(Institution $institution): RegistrationAuthority |
36 | 36 | { |
37 | - return $this->registrationAuthorities[(string)$institution]; |
|
37 | + return $this->registrationAuthorities[(string) $institution]; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function exists(Institution $institution): bool |
41 | 41 | { |
42 | - return array_key_exists((string)$institution, $this->registrationAuthorities); |
|
42 | + return array_key_exists((string) $institution, $this->registrationAuthorities); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function remove(Institution $institution): void |
46 | 46 | { |
47 | - unset($this->registrationAuthorities[(string)$institution]); |
|
47 | + unset($this->registrationAuthorities[(string) $institution]); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function count(): int |