1 | <?php |
||
28 | class SamlToken extends AbstractToken |
||
29 | { |
||
30 | /** |
||
31 | * @var \SAML2\Assertion |
||
32 | */ |
||
33 | public $assertion; |
||
34 | |||
35 | /** |
||
36 | * @var \Surfnet\StepupBundle\Value\Loa |
||
37 | */ |
||
38 | private $loa; |
||
39 | |||
40 | /** |
||
41 | * @var InstitutionConfigurationOptions |
||
42 | */ |
||
43 | private $institutionConfigurationOptions; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | private $raManagementInstitution; |
||
49 | |||
50 | /** |
||
51 | * The identity institution is set with the SHO of the identity. This value is not overridden like the user |
||
52 | * institution can be. This value can be used to get the identities institution regardless of the scope it |
||
53 | * is performing RAA tasks for at this moment. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | private $identityInstitution; |
||
58 | |||
59 | public function __construct( |
||
70 | |||
71 | /** |
||
72 | * @return InstitutionConfigurationOptions |
||
73 | */ |
||
74 | public function getInstitutionConfigurationOptions() |
||
78 | |||
79 | /** |
||
80 | * @param string $institution |
||
81 | * @param InstitutionConfigurationOptions $institutionConfigurationOptions |
||
82 | */ |
||
83 | public function changeInstitutionScope( |
||
84 | $institution, |
||
85 | InstitutionConfigurationOptions $institutionConfigurationOptions |
||
86 | ) { |
||
87 | if ($this->getUser() === null) { |
||
88 | throw new LogicException('Cannot change institution scope: token does not contain a user'); |
||
89 | } |
||
90 | |||
91 | $roles = array_map(function (RoleInterface $role) { |
||
92 | return $role->getRole(); |
||
93 | }, $this->getRoles()); |
||
94 | |||
95 | if (!in_array('ROLE_SRAA', $roles) && !in_array('ROLE_RAA', $roles) && !in_array('ROLE_RA', $roles)) { |
||
96 | throw new RuntimeException(sprintf( |
||
97 | 'Unauthorized to change institution scope to "%s": role (S)RA(A) required, found roles "%s"', |
||
98 | $institution, |
||
99 | implode(', ', $roles) |
||
100 | )); |
||
101 | } |
||
102 | |||
103 | $this->getUser()->institution = $institution; |
||
104 | $this->institutionConfigurationOptions = $institutionConfigurationOptions; |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * Returns the user credentials. |
||
109 | * |
||
110 | * @return mixed The user credentials |
||
111 | */ |
||
112 | public function getCredentials() |
||
116 | |||
117 | /** |
||
118 | * @return Loa |
||
119 | */ |
||
120 | public function getLoa() |
||
124 | |||
125 | public function serialize() |
||
137 | |||
138 | public function unserialize($serialized) |
||
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getIdentityInstitution() |
||
158 | |||
159 | |||
160 | /** |
||
161 | * @return string |
||
162 | */ |
||
163 | public function getRaManagementInstitution() |
||
170 | } |
||
171 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: