| Total Complexity | 118 |
| Total Lines | 986 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like ClientMetadata often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ClientMetadata, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 32 | class ClientMetadata |
||
| 33 | { |
||
| 34 | /** |
||
| 35 | * @ORM\Id |
||
| 36 | * @ORM\Column(type="integer") |
||
| 37 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 38 | */ |
||
| 39 | private $id; |
||
| 40 | private $client_id; |
||
| 41 | private $client_secret; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @var ClientInterface |
||
| 45 | * @ORM\OneToOne(targetEntity="LoginCidadao\OAuthBundle\Entity\Client", inversedBy="metadata", cascade={"persist"}) |
||
| 46 | * @ORM\JoinColumn(name="client_id", referencedColumnName="id") |
||
| 47 | */ |
||
| 48 | private $client; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @var string[] |
||
| 52 | * |
||
| 53 | * @JMS\Expose |
||
| 54 | * @JMS\Groups({"client_metadata"}) |
||
| 55 | * @Assert\All({ |
||
| 56 | * @Assert\Type(type="string"), |
||
| 57 | * @Assert\NotBlank, |
||
| 58 | * @Assert\Url(checkDNS = false) |
||
| 59 | * }) |
||
| 60 | * @ORM\Column(name="redirect_uris", type="json_array", nullable=false) |
||
| 61 | */ |
||
| 62 | private $redirect_uris; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @JMS\Expose |
||
| 66 | * @JMS\Groups({"client_metadata"}) |
||
| 67 | * @Assert\All({ |
||
| 68 | * @Assert\Type("string") |
||
| 69 | * }) |
||
| 70 | * @ORM\Column(name="response_types", type="simple_array", nullable=false) |
||
| 71 | */ |
||
| 72 | private $response_types = ['code']; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @JMS\Expose |
||
| 76 | * @JMS\Groups({"client_metadata"}) |
||
| 77 | * @Assert\All({ |
||
| 78 | * @Assert\Type("string") |
||
| 79 | * }) |
||
| 80 | * @ORM\Column(type="simple_array", nullable=false) |
||
| 81 | */ |
||
| 82 | private $grant_types = ['authorization_code']; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @JMS\Expose |
||
| 86 | * @JMS\Groups({"client_metadata"}) |
||
| 87 | * @Assert\Type(type="string") |
||
| 88 | * @ORM\Column(name="application_type", type="string", length=100, nullable=false) |
||
| 89 | */ |
||
| 90 | private $application_type = 'web'; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @JMS\Expose |
||
| 94 | * @JMS\Groups({"client_metadata"}) |
||
| 95 | * @Assert\All({ |
||
| 96 | * @Assert\Type("string") |
||
| 97 | * }) |
||
| 98 | * @ORM\Column(type="simple_array", nullable=true) |
||
| 99 | */ |
||
| 100 | private $contacts; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @JMS\Expose |
||
| 104 | * @JMS\Groups({"client_metadata"}) |
||
| 105 | * @Assert\Type(type="string") |
||
| 106 | * @ORM\Column(type="string", nullable=true) |
||
| 107 | */ |
||
| 108 | private $client_name; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @JMS\Expose |
||
| 112 | * @JMS\Groups({"client_metadata"}) |
||
| 113 | * @Assert\Type(type="string") |
||
| 114 | * @Assert\Url(checkDNS = false) |
||
| 115 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 116 | */ |
||
| 117 | private $logo_uri; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * @JMS\Expose |
||
| 121 | * @JMS\Groups({"client_metadata"}) |
||
| 122 | * @Assert\Type(type="string") |
||
| 123 | * @Assert\Url(checkDNS = false) |
||
| 124 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 125 | */ |
||
| 126 | private $client_uri; |
||
| 127 | |||
| 128 | /** |
||
| 129 | * @JMS\Expose |
||
| 130 | * @JMS\Groups({"client_metadata"}) |
||
| 131 | * @Assert\Type(type="string") |
||
| 132 | * @Assert\Url(checkDNS = false) |
||
| 133 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 134 | */ |
||
| 135 | private $policy_uri; |
||
| 136 | |||
| 137 | /** |
||
| 138 | * @JMS\Expose |
||
| 139 | * @JMS\Groups({"client_metadata"}) |
||
| 140 | * @Assert\Url(checkDNS = false) |
||
| 141 | * @Assert\Type(type="string") |
||
| 142 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 143 | */ |
||
| 144 | private $tos_uri; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @JMS\Expose |
||
| 148 | * @JMS\Groups({"client_metadata"}) |
||
| 149 | * @Assert\Url(checkDNS = false) |
||
| 150 | * @Assert\Type(type="string") |
||
| 151 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 152 | */ |
||
| 153 | private $jwks_uri; |
||
| 154 | |||
| 155 | /** |
||
| 156 | * @JMS\Expose |
||
| 157 | * @JMS\Groups({"client_metadata"}) |
||
| 158 | * @Assert\Type(type="string") |
||
| 159 | * @ORM\Column(type="text", nullable=true) |
||
| 160 | */ |
||
| 161 | private $jwks; |
||
| 162 | |||
| 163 | /** |
||
| 164 | * @JMS\Expose |
||
| 165 | * @JMS\Groups({"client_metadata"}) |
||
| 166 | * @Assert\Url(checkDNS = false, protocols = {"http", "https"}) |
||
| 167 | * @Assert\Type(type="string") |
||
| 168 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 169 | */ |
||
| 170 | private $sector_identifier_uri; |
||
| 171 | |||
| 172 | /** |
||
| 173 | * @JMS\Expose |
||
| 174 | * @JMS\Groups({"client_metadata"}) |
||
| 175 | * @Assert\Type(type="string") |
||
| 176 | * @ORM\Column(type="string", length=20, nullable=false, options={"default" : "pairwise"}) |
||
| 177 | */ |
||
| 178 | private $subject_type = 'pairwise'; |
||
| 179 | |||
| 180 | /** |
||
| 181 | * @JMS\Expose |
||
| 182 | * @JMS\Groups({"client_metadata"}) |
||
| 183 | * @Assert\Type(type="string") |
||
| 184 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 185 | */ |
||
| 186 | private $id_token_signed_response_alg; |
||
| 187 | |||
| 188 | /** |
||
| 189 | * @JMS\Expose |
||
| 190 | * @JMS\Groups({"client_metadata"}) |
||
| 191 | * @Assert\Type(type="string") |
||
| 192 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 193 | */ |
||
| 194 | private $id_token_encrypted_response_alg; |
||
| 195 | |||
| 196 | /** |
||
| 197 | * @JMS\Expose |
||
| 198 | * @JMS\Groups({"client_metadata"}) |
||
| 199 | * @Assert\Type(type="string") |
||
| 200 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 201 | */ |
||
| 202 | private $id_token_encrypted_response_enc; |
||
| 203 | |||
| 204 | /** |
||
| 205 | * @JMS\Expose |
||
| 206 | * @JMS\Groups({"client_metadata"}) |
||
| 207 | * @Assert\Type(type="string") |
||
| 208 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 209 | */ |
||
| 210 | private $userinfo_signed_response_alg; |
||
| 211 | |||
| 212 | /** |
||
| 213 | * @JMS\Expose |
||
| 214 | * @JMS\Groups({"client_metadata"}) |
||
| 215 | * @Assert\Type(type="string") |
||
| 216 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 217 | */ |
||
| 218 | private $userinfo_encrypted_response_alg; |
||
| 219 | |||
| 220 | /** |
||
| 221 | * @JMS\Expose |
||
| 222 | * @JMS\Groups({"client_metadata"}) |
||
| 223 | * @Assert\Type(type="string") |
||
| 224 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 225 | */ |
||
| 226 | private $userinfo_encrypted_response_enc; |
||
| 227 | |||
| 228 | /** |
||
| 229 | * @JMS\Expose |
||
| 230 | * @JMS\Groups({"client_metadata"}) |
||
| 231 | * @Assert\Type(type="string") |
||
| 232 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 233 | */ |
||
| 234 | private $request_object_signing_alg; |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @JMS\Expose |
||
| 238 | * @JMS\Groups({"client_metadata"}) |
||
| 239 | * @Assert\Type(type="string") |
||
| 240 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 241 | */ |
||
| 242 | private $request_object_encryption_alg; |
||
| 243 | |||
| 244 | /** |
||
| 245 | * @JMS\Expose |
||
| 246 | * @JMS\Groups({"client_metadata"}) |
||
| 247 | * @Assert\Type(type="string") |
||
| 248 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 249 | */ |
||
| 250 | private $request_object_encryption_enc; |
||
| 251 | |||
| 252 | /** |
||
| 253 | * @JMS\Expose |
||
| 254 | * @JMS\Groups({"client_metadata"}) |
||
| 255 | * @Assert\Type(type="string") |
||
| 256 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 257 | */ |
||
| 258 | private $token_endpoint_auth_method; |
||
| 259 | |||
| 260 | /** |
||
| 261 | * @JMS\Expose |
||
| 262 | * @JMS\Groups({"client_metadata"}) |
||
| 263 | * @Assert\Type(type="string") |
||
| 264 | * @ORM\Column(type="string", length=50, nullable=true) |
||
| 265 | */ |
||
| 266 | private $token_endpoint_auth_signing_alg; |
||
| 267 | |||
| 268 | /** |
||
| 269 | * @JMS\Expose |
||
| 270 | * @JMS\Groups({"client_metadata"}) |
||
| 271 | * @Assert\Type(type="integer") |
||
| 272 | * @ORM\Column(type="integer", nullable=true) |
||
| 273 | */ |
||
| 274 | private $default_max_age; |
||
| 275 | |||
| 276 | /** |
||
| 277 | * @JMS\Expose |
||
| 278 | * @JMS\Groups({"client_metadata"}) |
||
| 279 | * @Assert\Type(type="boolean") |
||
| 280 | */ |
||
| 281 | private $require_auth_time = false; |
||
| 282 | |||
| 283 | /** |
||
| 284 | * @JMS\Expose |
||
| 285 | * @JMS\Groups({"client_metadata"}) |
||
| 286 | * @Assert\Type(type="array") |
||
| 287 | * @ORM\Column(type="simple_array", nullable=true) |
||
| 288 | */ |
||
| 289 | private $default_acr_values; |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @JMS\Expose |
||
| 293 | * @JMS\Groups({"client_metadata"}) |
||
| 294 | * @Assert\Url(checkDNS = false) |
||
| 295 | * @Assert\Type(type="string") |
||
| 296 | * @ORM\Column(type="string", length=2000, nullable=true) |
||
| 297 | */ |
||
| 298 | private $initiate_login_uri; |
||
| 299 | |||
| 300 | /** |
||
| 301 | * @JMS\Expose |
||
| 302 | * @JMS\Groups({"client_metadata"}) |
||
| 303 | * @Assert\All({ |
||
| 304 | * @Assert\Type("string"), |
||
| 305 | * @Assert\Url(checkDNS = false) |
||
| 306 | * }) |
||
| 307 | * @ORM\Column(type="simple_array", nullable=true) |
||
| 308 | */ |
||
| 309 | private $request_uris; |
||
| 310 | |||
| 311 | /** |
||
| 312 | * @JMS\Expose |
||
| 313 | * @JMS\Groups({"client_metadata"}) |
||
| 314 | * @Assert\Type(type="string") |
||
| 315 | * @ORM\Column(type="string", nullable=true) |
||
| 316 | */ |
||
| 317 | private $registration_access_token; |
||
| 318 | |||
| 319 | /** |
||
| 320 | * @var OrganizationInterface |
||
| 321 | * @ORM\ManyToOne(targetEntity="LoginCidadao\OAuthBundle\Model\OrganizationInterface", inversedBy="clients") |
||
| 322 | * @ORM\JoinColumn(name="organization_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 323 | */ |
||
| 324 | private $organization; |
||
| 325 | |||
| 326 | /** |
||
| 327 | * @JMS\Expose |
||
| 328 | * @JMS\Groups({"client_metadata"}) |
||
| 329 | * @Assert\All({ |
||
| 330 | * @Assert\Type("string"), |
||
| 331 | * @Assert\Url(checkDNS = false) |
||
| 332 | * }) |
||
| 333 | * @ORM\Column(type="simple_array", nullable=true) |
||
| 334 | */ |
||
| 335 | private $post_logout_redirect_uris; |
||
| 336 | |||
| 337 | public function __construct() |
||
| 338 | { |
||
| 339 | $this->response_types = ['code']; |
||
|
|
|||
| 340 | $this->grant_types = ['authorization_code']; |
||
| 341 | $this->application_type = 'web'; |
||
| 342 | $this->require_auth_time = false; |
||
| 343 | $this->subject_type = 'pairwise'; |
||
| 344 | } |
||
| 345 | |||
| 346 | /** |
||
| 347 | * @param mixed $id |
||
| 348 | * @return $this |
||
| 349 | */ |
||
| 350 | public function setId($id) |
||
| 351 | { |
||
| 352 | $this->id = $id; |
||
| 353 | |||
| 354 | return $this; |
||
| 355 | } |
||
| 356 | |||
| 357 | /** |
||
| 358 | * @return string[] |
||
| 359 | */ |
||
| 360 | public function getRedirectUris() |
||
| 361 | { |
||
| 362 | return $this->redirect_uris; |
||
| 363 | } |
||
| 364 | |||
| 365 | public function setRedirectUris($redirect_uris) |
||
| 366 | { |
||
| 367 | $this->redirect_uris = $redirect_uris; |
||
| 368 | |||
| 369 | return $this; |
||
| 370 | } |
||
| 371 | |||
| 372 | public function getResponseTypes() |
||
| 373 | { |
||
| 374 | return $this->response_types; |
||
| 375 | } |
||
| 376 | |||
| 377 | public function setResponseTypes($response_types) |
||
| 378 | { |
||
| 379 | $this->response_types = $response_types; |
||
| 380 | |||
| 381 | return $this; |
||
| 382 | } |
||
| 383 | |||
| 384 | public function getGrantTypes() |
||
| 385 | { |
||
| 386 | return $this->grant_types; |
||
| 387 | } |
||
| 388 | |||
| 389 | public function setGrantTypes($grant_types) |
||
| 394 | } |
||
| 395 | |||
| 396 | public function getApplicationType() |
||
| 397 | { |
||
| 398 | return $this->application_type; |
||
| 399 | } |
||
| 400 | |||
| 401 | public function setApplicationType($application_type) |
||
| 402 | { |
||
| 403 | $this->application_type = $application_type; |
||
| 404 | |||
| 405 | return $this; |
||
| 406 | } |
||
| 407 | |||
| 408 | public function getContacts() |
||
| 409 | { |
||
| 410 | $owners = []; |
||
| 411 | if ($this->getClient()) { |
||
| 412 | $owners = array_map( |
||
| 413 | function (PersonInterface $owner) { |
||
| 414 | return $owner->getEmail(); |
||
| 415 | }, |
||
| 416 | $this->getClient()->getOwners()->toArray() |
||
| 417 | ); |
||
| 418 | } |
||
| 419 | $contacts = is_array($this->contacts) ? $this->contacts : []; |
||
| 420 | |||
| 421 | return array_unique(array_merge($contacts, $owners)); |
||
| 422 | } |
||
| 423 | |||
| 424 | public function setContacts($contacts) |
||
| 425 | { |
||
| 426 | $this->contacts = $contacts; |
||
| 427 | |||
| 428 | return $this; |
||
| 429 | } |
||
| 430 | |||
| 431 | public function getClientName() |
||
| 432 | { |
||
| 433 | return $this->client_name; |
||
| 434 | } |
||
| 435 | |||
| 436 | public function setClientName($client_name) |
||
| 437 | { |
||
| 438 | $this->client_name = $client_name; |
||
| 439 | |||
| 440 | return $this; |
||
| 441 | } |
||
| 442 | |||
| 443 | public function getLogoUri() |
||
| 444 | { |
||
| 445 | return $this->logo_uri; |
||
| 446 | } |
||
| 447 | |||
| 448 | public function setLogoUri($logo_uri) |
||
| 449 | { |
||
| 450 | $this->logo_uri = $logo_uri; |
||
| 451 | |||
| 452 | return $this; |
||
| 453 | } |
||
| 454 | |||
| 455 | public function getClientUri() |
||
| 456 | { |
||
| 457 | return $this->client_uri; |
||
| 458 | } |
||
| 459 | |||
| 460 | public function setClientUri($client_uri) |
||
| 461 | { |
||
| 462 | $this->client_uri = $client_uri; |
||
| 463 | |||
| 464 | return $this; |
||
| 465 | } |
||
| 466 | |||
| 467 | public function getPolicyUri() |
||
| 468 | { |
||
| 469 | return $this->policy_uri; |
||
| 470 | } |
||
| 471 | |||
| 472 | public function setPolicyUri($policy_uri) |
||
| 473 | { |
||
| 474 | $this->policy_uri = $policy_uri; |
||
| 475 | |||
| 476 | return $this; |
||
| 477 | } |
||
| 478 | |||
| 479 | public function getTosUri() |
||
| 480 | { |
||
| 481 | return $this->tos_uri; |
||
| 482 | } |
||
| 483 | |||
| 484 | public function setTosUri($tos_uri) |
||
| 485 | { |
||
| 486 | $this->tos_uri = $tos_uri; |
||
| 487 | |||
| 488 | return $this; |
||
| 489 | } |
||
| 490 | |||
| 491 | public function getJwksUri() |
||
| 492 | { |
||
| 493 | return $this->jwks_uri; |
||
| 494 | } |
||
| 495 | |||
| 496 | public function setJwksUri($jwks_uri) |
||
| 497 | { |
||
| 498 | $this->jwks_uri = $jwks_uri; |
||
| 499 | |||
| 500 | return $this; |
||
| 501 | } |
||
| 502 | |||
| 503 | public function getJwks() |
||
| 504 | { |
||
| 505 | return $this->jwks; |
||
| 506 | } |
||
| 507 | |||
| 508 | public function setJwks($jwks) |
||
| 509 | { |
||
| 510 | $this->jwks = $jwks; |
||
| 511 | |||
| 512 | return $this; |
||
| 513 | } |
||
| 514 | |||
| 515 | public function getSectorIdentifierUri() |
||
| 516 | { |
||
| 517 | return $this->sector_identifier_uri; |
||
| 518 | } |
||
| 519 | |||
| 520 | public function setSectorIdentifierUri($sector_identifier_uri) |
||
| 521 | { |
||
| 522 | $this->sector_identifier_uri = $sector_identifier_uri; |
||
| 523 | |||
| 524 | return $this; |
||
| 525 | } |
||
| 526 | |||
| 527 | /** |
||
| 528 | * @return string|null |
||
| 529 | */ |
||
| 530 | public function getSubjectType() |
||
| 531 | { |
||
| 532 | return $this->subject_type; |
||
| 533 | } |
||
| 534 | |||
| 535 | /** |
||
| 536 | * @param string $subject_type |
||
| 537 | * @return ClientMetadata |
||
| 538 | */ |
||
| 539 | public function setSubjectType($subject_type) |
||
| 540 | { |
||
| 541 | $this->subject_type = $subject_type; |
||
| 542 | |||
| 543 | return $this; |
||
| 544 | } |
||
| 545 | |||
| 546 | public function getIdTokenSignedResponseAlg() |
||
| 547 | { |
||
| 548 | return $this->id_token_signed_response_alg; |
||
| 549 | } |
||
| 550 | |||
| 551 | public function setIdTokenSignedResponseAlg($id_token_signed_response_alg) |
||
| 552 | { |
||
| 553 | $this->id_token_signed_response_alg = $id_token_signed_response_alg; |
||
| 554 | |||
| 555 | return $this; |
||
| 556 | } |
||
| 557 | |||
| 558 | public function getIdTokenEncryptedResponseAlg() |
||
| 559 | { |
||
| 560 | return $this->id_token_encrypted_response_alg; |
||
| 561 | } |
||
| 562 | |||
| 563 | public function setIdTokenEncryptedResponseAlg($id_token_encrypted_response_alg) |
||
| 564 | { |
||
| 565 | $this->id_token_encrypted_response_alg = $id_token_encrypted_response_alg; |
||
| 566 | |||
| 567 | return $this; |
||
| 568 | } |
||
| 569 | |||
| 570 | public function getIdTokenEncryptedResponseEnc() |
||
| 571 | { |
||
| 572 | return $this->id_token_encrypted_response_enc; |
||
| 573 | } |
||
| 574 | |||
| 575 | public function setIdTokenEncryptedResponseEnc($id_token_encrypted_response_enc) |
||
| 576 | { |
||
| 577 | $this->id_token_encrypted_response_enc = $id_token_encrypted_response_enc; |
||
| 578 | |||
| 579 | return $this; |
||
| 580 | } |
||
| 581 | |||
| 582 | public function getUserinfoSignedResponseAlg() |
||
| 583 | { |
||
| 584 | return $this->userinfo_signed_response_alg; |
||
| 585 | } |
||
| 586 | |||
| 587 | public function setUserinfoSignedResponseAlg($userinfo_signed_response_alg) |
||
| 588 | { |
||
| 589 | $this->userinfo_signed_response_alg = $userinfo_signed_response_alg; |
||
| 590 | |||
| 591 | return $this; |
||
| 592 | } |
||
| 593 | |||
| 594 | public function getUserinfoEncryptedResponseAlg() |
||
| 595 | { |
||
| 596 | return $this->userinfo_encrypted_response_alg; |
||
| 597 | } |
||
| 598 | |||
| 599 | public function setUserinfoEncryptedResponseAlg($userinfo_encrypted_response_alg) |
||
| 600 | { |
||
| 601 | $this->userinfo_encrypted_response_alg = $userinfo_encrypted_response_alg; |
||
| 602 | |||
| 603 | return $this; |
||
| 604 | } |
||
| 605 | |||
| 606 | public function getUserinfoEncryptedResponseEnc() |
||
| 607 | { |
||
| 608 | return $this->userinfo_encrypted_response_enc; |
||
| 609 | } |
||
| 610 | |||
| 611 | public function setUserinfoEncryptedResponseEnc($userinfo_encrypted_response_enc) |
||
| 612 | { |
||
| 613 | $this->userinfo_encrypted_response_enc = $userinfo_encrypted_response_enc; |
||
| 614 | |||
| 615 | return $this; |
||
| 616 | } |
||
| 617 | |||
| 618 | public function getRequestObjectSigningAlg() |
||
| 619 | { |
||
| 620 | return $this->request_object_signing_alg; |
||
| 621 | } |
||
| 622 | |||
| 623 | public function setRequestObjectSigningAlg($request_object_signing_alg) |
||
| 624 | { |
||
| 625 | $this->request_object_signing_alg = $request_object_signing_alg; |
||
| 626 | |||
| 627 | return $this; |
||
| 628 | } |
||
| 629 | |||
| 630 | public function getRequestObjectEncryptionAlg() |
||
| 631 | { |
||
| 632 | return $this->request_object_encryption_alg; |
||
| 633 | } |
||
| 634 | |||
| 635 | public function setRequestObjectEncryptionAlg($request_object_encryption_alg) |
||
| 636 | { |
||
| 637 | $this->request_object_encryption_alg = $request_object_encryption_alg; |
||
| 638 | |||
| 639 | return $this; |
||
| 640 | } |
||
| 641 | |||
| 642 | public function getRequestObjectEncryptionEnc() |
||
| 643 | { |
||
| 644 | return $this->request_object_encryption_enc; |
||
| 645 | } |
||
| 646 | |||
| 647 | public function setRequestObjectEncryptionEnc($request_object_encryption_enc) |
||
| 652 | } |
||
| 653 | |||
| 654 | public function getTokenEndpointAuthMethod() |
||
| 655 | { |
||
| 656 | return $this->token_endpoint_auth_method; |
||
| 657 | } |
||
| 658 | |||
| 659 | public function setTokenEndpointAuthMethod($token_endpoint_auth_method) |
||
| 660 | { |
||
| 661 | $this->token_endpoint_auth_method = $token_endpoint_auth_method; |
||
| 662 | |||
| 663 | return $this; |
||
| 664 | } |
||
| 665 | |||
| 666 | public function getTokenEndpointAuthSigningAlg() |
||
| 667 | { |
||
| 668 | return $this->token_endpoint_auth_signing_alg; |
||
| 669 | } |
||
| 670 | |||
| 671 | public function setTokenEndpointAuthSigningAlg($token_endpoint_auth_signing_alg) |
||
| 672 | { |
||
| 673 | $this->token_endpoint_auth_signing_alg = $token_endpoint_auth_signing_alg; |
||
| 674 | |||
| 675 | return $this; |
||
| 676 | } |
||
| 677 | |||
| 678 | public function getDefaultMaxAge() |
||
| 679 | { |
||
| 680 | return $this->default_max_age; |
||
| 681 | } |
||
| 682 | |||
| 683 | public function setDefaultMaxAge($default_max_age) |
||
| 684 | { |
||
| 685 | $this->default_max_age = $default_max_age; |
||
| 686 | |||
| 687 | return $this; |
||
| 688 | } |
||
| 689 | |||
| 690 | public function getRequireAuthTime() |
||
| 691 | { |
||
| 692 | return $this->require_auth_time; |
||
| 693 | } |
||
| 694 | |||
| 695 | public function setRequireAuthTime($require_auth_time) |
||
| 696 | { |
||
| 697 | $this->require_auth_time = $require_auth_time; |
||
| 698 | |||
| 699 | return $this; |
||
| 700 | } |
||
| 701 | |||
| 702 | public function getDefaultAcrValues() |
||
| 703 | { |
||
| 704 | return $this->default_acr_values; |
||
| 705 | } |
||
| 706 | |||
| 707 | /** |
||
| 708 | * @param $default_acr_values |
||
| 709 | * @return ClientMetadata |
||
| 710 | */ |
||
| 711 | public function setDefaultAcrValues($default_acr_values) |
||
| 712 | { |
||
| 713 | $this->default_acr_values = $default_acr_values; |
||
| 714 | |||
| 715 | return $this; |
||
| 716 | } |
||
| 717 | |||
| 718 | public function getInitiateLoginUri() |
||
| 719 | { |
||
| 720 | return $this->initiate_login_uri; |
||
| 721 | } |
||
| 722 | |||
| 723 | /** |
||
| 724 | * @param $initiate_login_uri |
||
| 725 | * @return ClientMetadata |
||
| 726 | */ |
||
| 727 | public function setInitiateLoginUri($initiate_login_uri) |
||
| 728 | { |
||
| 729 | $this->initiate_login_uri = $initiate_login_uri; |
||
| 730 | |||
| 731 | return $this; |
||
| 732 | } |
||
| 733 | |||
| 734 | public function getRequestUris() |
||
| 735 | { |
||
| 736 | return $this->request_uris; |
||
| 737 | } |
||
| 738 | |||
| 739 | public function setRequestUris($request_uris) |
||
| 740 | { |
||
| 741 | $this->request_uris = $request_uris; |
||
| 742 | |||
| 743 | return $this; |
||
| 744 | } |
||
| 745 | |||
| 746 | /** |
||
| 747 | * @JMS\Groups({"client_metadata"}) |
||
| 748 | * @JMS\VirtualProperty |
||
| 749 | * @JMS\SerializedName("client_id") |
||
| 750 | */ |
||
| 751 | public function getClientId() |
||
| 752 | { |
||
| 753 | if ($this->client_id === null && $this->client) { |
||
| 754 | return $this->client->getClientId(); |
||
| 755 | } |
||
| 756 | |||
| 757 | return $this->client_id; |
||
| 758 | } |
||
| 759 | |||
| 760 | public function setClientId($client_id) |
||
| 761 | { |
||
| 762 | $this->client_id = $client_id; |
||
| 763 | |||
| 764 | return $this; |
||
| 765 | } |
||
| 766 | |||
| 767 | /** |
||
| 768 | * @JMS\Groups({"client_metadata"}) |
||
| 769 | * @JMS\VirtualProperty |
||
| 770 | * @JMS\SerializedName("client_secret") |
||
| 771 | */ |
||
| 772 | public function getClientSecret() |
||
| 773 | { |
||
| 774 | if ($this->client_id === null && $this->client) { |
||
| 775 | return $this->client->getClientSecret(); |
||
| 776 | } |
||
| 777 | |||
| 778 | return $this->client_secret; |
||
| 779 | } |
||
| 780 | |||
| 781 | public function setClientSecret($client_secret) |
||
| 782 | { |
||
| 783 | $this->client_secret = $client_secret; |
||
| 784 | |||
| 785 | return $this; |
||
| 786 | } |
||
| 787 | |||
| 788 | /** |
||
| 789 | * @param Client $client |
||
| 790 | * @return ClientMetadata |
||
| 791 | */ |
||
| 792 | public function fromClient(Client $client) |
||
| 793 | { |
||
| 794 | $this->setGrantTypes($client->getAllowedGrantTypes()) |
||
| 795 | ->setClientUri($client->getSiteUrl()) |
||
| 796 | ->setTosUri($client->getTermsOfUseUrl()) |
||
| 797 | ->setClientName($client->getName()) |
||
| 798 | ->setRedirectUris($client->getRedirectUris()); |
||
| 799 | |||
| 800 | $this->setClientId($client->getPublicId()) |
||
| 801 | ->setClientSecret($client->getSecret()); |
||
| 802 | |||
| 803 | return $this; |
||
| 804 | } |
||
| 805 | |||
| 806 | /** |
||
| 807 | * @return Client |
||
| 808 | */ |
||
| 809 | public function toClient() |
||
| 810 | { |
||
| 811 | $grantTypes = $this->getGrantTypes(); |
||
| 812 | $clientUri = $this->getClientUri(); |
||
| 813 | $tosUri = $this->getTosUri(); |
||
| 814 | $clientName = $this->getClientName(); |
||
| 815 | $redirectUris = $this->getRedirectUris(); |
||
| 816 | |||
| 817 | $client = new Client(); |
||
| 818 | |||
| 819 | if ($grantTypes) { |
||
| 820 | $client->setAllowedGrantTypes($grantTypes); |
||
| 821 | } |
||
| 822 | |||
| 823 | if ($clientUri) { |
||
| 824 | $client->setLandingPageUrl($clientUri) |
||
| 825 | ->setSiteUrl($clientUri); |
||
| 826 | } |
||
| 827 | |||
| 828 | if ($tosUri) { |
||
| 829 | $client->setTermsOfUseUrl($tosUri); |
||
| 830 | } |
||
| 831 | |||
| 832 | if ($clientName) { |
||
| 833 | $client->setName($clientName); |
||
| 834 | } |
||
| 835 | |||
| 836 | if (count($redirectUris) > 0) { |
||
| 837 | $client->setRedirectUris($redirectUris); |
||
| 838 | } |
||
| 839 | |||
| 840 | $client->setVisible(false) |
||
| 841 | ->setPublished(false); |
||
| 842 | |||
| 843 | return $client; |
||
| 844 | } |
||
| 845 | |||
| 846 | public function getClient() |
||
| 849 | } |
||
| 850 | |||
| 851 | public function setClient(ClientInterface $client) |
||
| 852 | { |
||
| 853 | $this->client = $client; |
||
| 854 | |||
| 855 | return $this; |
||
| 856 | } |
||
| 857 | |||
| 858 | /** |
||
| 859 | * @ORM\PrePersist() |
||
| 860 | */ |
||
| 861 | public function checkDefaults() |
||
| 862 | { |
||
| 863 | $this->enforceDefaultGrantTypes(); |
||
| 864 | $this->enforceDefaultResponseTypes(); |
||
| 865 | $this->enforceDefaultApplicationType(); |
||
| 866 | $this->enforceDefaultRequireAuthTime(); |
||
| 867 | $this->enforceDefaultIdTokenSignedResponseAlg(); |
||
| 868 | $this->enforceDefaultTokenEndpointAuthMethod(); |
||
| 869 | $this->enforceValidSubjectType(); |
||
| 870 | } |
||
| 871 | |||
| 872 | private function enforceDefaultGrantTypes() |
||
| 873 | { |
||
| 874 | if (!$this->getGrantTypes()) { |
||
| 875 | $this->setGrantTypes(['authorization_code']); |
||
| 876 | } |
||
| 877 | } |
||
| 878 | |||
| 879 | private function enforceDefaultResponseTypes() |
||
| 880 | { |
||
| 881 | if (!$this->getResponseTypes()) { |
||
| 882 | $this->setResponseTypes(['code']); |
||
| 883 | } |
||
| 884 | } |
||
| 885 | |||
| 886 | private function enforceDefaultApplicationType() |
||
| 887 | { |
||
| 888 | if (!$this->getApplicationType()) { |
||
| 889 | $this->setApplicationType('web'); |
||
| 890 | } |
||
| 891 | } |
||
| 892 | |||
| 893 | private function enforceDefaultRequireAuthTime() |
||
| 894 | { |
||
| 895 | if (!$this->getRequireAuthTime()) { |
||
| 896 | $this->setRequireAuthTime(false); |
||
| 897 | } |
||
| 898 | } |
||
| 899 | |||
| 900 | private function enforceDefaultIdTokenSignedResponseAlg() |
||
| 901 | { |
||
| 902 | if (!$this->getIdTokenSignedResponseAlg()) { |
||
| 903 | $this->setIdTokenSignedResponseAlg('RS256'); |
||
| 904 | } |
||
| 905 | } |
||
| 906 | |||
| 907 | private function enforceDefaultTokenEndpointAuthMethod() |
||
| 908 | { |
||
| 909 | if (!$this->getTokenEndpointAuthMethod()) { |
||
| 910 | $this->setTokenEndpointAuthMethod('client_secret_basic'); |
||
| 911 | } |
||
| 912 | } |
||
| 913 | |||
| 914 | private function enforceValidSubjectType() |
||
| 915 | { |
||
| 916 | if (false === array_search($this->getSubjectType(), ['public', 'pairwise'])) { |
||
| 917 | $this->setSubjectType('pairwise'); |
||
| 918 | } |
||
| 919 | } |
||
| 920 | |||
| 921 | public function getSectorIdentifier() |
||
| 922 | { |
||
| 923 | $siUri = $this->getSectorIdentifierUri(); |
||
| 924 | if ($siUri) { |
||
| 925 | $uri = $siUri; |
||
| 926 | } else { |
||
| 927 | $uris = $this->getRedirectUris(); |
||
| 928 | $uri = reset($uris); |
||
| 929 | } |
||
| 930 | |||
| 931 | return parse_url($uri, PHP_URL_HOST); |
||
| 932 | } |
||
| 933 | |||
| 934 | public function getRegistrationAccessToken() |
||
| 935 | { |
||
| 936 | return $this->registration_access_token; |
||
| 937 | } |
||
| 938 | |||
| 939 | /** |
||
| 940 | * @param string $registration_access_token |
||
| 941 | * @return ClientMetadata |
||
| 942 | */ |
||
| 943 | public function setRegistrationAccessToken($registration_access_token) |
||
| 944 | { |
||
| 945 | $this->registration_access_token = $registration_access_token; |
||
| 946 | |||
| 947 | return $this; |
||
| 948 | } |
||
| 949 | |||
| 950 | /** |
||
| 951 | * @return OrganizationInterface |
||
| 952 | */ |
||
| 953 | public function getOrganization() |
||
| 954 | { |
||
| 955 | return $this->organization; |
||
| 956 | } |
||
| 957 | |||
| 958 | /** |
||
| 959 | * @param OrganizationInterface $organization |
||
| 960 | */ |
||
| 961 | public function setOrganization($organization = null) |
||
| 962 | { |
||
| 963 | $this->organization = $organization; |
||
| 964 | } |
||
| 965 | |||
| 966 | /** |
||
| 967 | * @return array |
||
| 968 | */ |
||
| 969 | public function getPostLogoutRedirectUris() |
||
| 976 | ); |
||
| 977 | } |
||
| 978 | |||
| 979 | /** |
||
| 980 | * @param array |
||
| 981 | * @return ClientMetadata |
||
| 982 | */ |
||
| 983 | public function setPostLogoutRedirectUris($post_logout_redirect_uris) |
||
| 984 | { |
||
| 985 | $this->post_logout_redirect_uris = $post_logout_redirect_uris; |
||
| 986 | |||
| 987 | return $this; |
||
| 988 | } |
||
| 989 | |||
| 990 | /** |
||
| 991 | * Add trailing slashes |
||
| 992 | * @param $uri |
||
| 993 | * @return string |
||
| 994 | */ |
||
| 995 | public static function canonicalizeUri($uri) |
||
| 1003 | } |
||
| 1004 | |||
| 1005 | private static function unparseUrl($parsed_url) |
||
| 1006 | { |
||
| 1007 | $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
||
| 1008 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
||
| 1009 | $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
||
| 1010 | $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; |
||
| 1011 | $pass = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : ''; |
||
| 1012 | $pass = ($user || $pass) ? "$pass@" : ''; |
||
| 1013 | $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; |
||
| 1014 | $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
||
| 1015 | $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
||
| 1016 | |||
| 1017 | return "$scheme$user$pass$host$port$path$query$fragment"; |
||
| 1018 | } |
||
| 1019 | } |
||
| 1020 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..