Skip to content

Commit 3d09656

Browse files
committed
minor #43361 [Security] Add getter for attributes property (pluk77)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] Add getter for attributes property This addition prevents the need to overload the $attributes property when extending this class to get access to all attributes at once. Currently, there is no way to get all attributes out of the passport without knowing the names of each attribute. hslavich/OneloginSamlBundle#181 (comment) | Q | A | ------------- | --- | Branch? | 5.4 for features | Bug fix? | no | New feature? | Enhancement | Deprecations? | no | Tickets | | License | MIT | Doc PR | symfony/symfony-docs# Authenticators do not have access to all attributes in the passport at once, nor can they set them at once. The only way currently is to over-load the $attributes in an extended passport class. Current code also stops a Subscriber/Listener (to for example CheckPassportEvent) from accessing all the current attributes without knowing their name. Not having access or being able to set all attributes at once is particularly nasty when the attributes are set based on a SAML token. They can currently be set one at a time, but they can not be retrieved without knowing their names. Commits ------- dc0a4a543d Add getters and setters for attributes property
2 parents 64a60f2 + 9d77646 commit 3d09656

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Authenticator/Passport/Passport.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,9 @@ public function getAttribute(string $name, $default = null)
103103
{
104104
return $this->attributes[$name] ?? $default;
105105
}
106+
107+
public function getAttributes(): array
108+
{
109+
return $this->attributes;
110+
}
106111
}

0 commit comments

Comments
 (0)