8000 [Security] Add attributes on Passport · symfony/symfony@c7504a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7504a0

Browse files
committed
[Security] Add attributes on Passport
1 parent 6f6e4ce commit c7504a0

File tree

1 file changed

+20
-0
lines changed
  • src/Symfony/Component/Security/Http/Authenticator/Passport

1 file changed

+20
-0
lines changed

src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class Passport implements UserPassportInterface
2828

2929
protected $user;
3030

31+
private $attributes = [];
32+
3133
/**
3234
* @param CredentialsInterface $credentials the credentials to check for this authentication, use
3335
* SelfValidatingPassport if no credentials should be checked.
@@ -47,4 +49,22 @@ public function getUser(): UserInterface
4749
{
4850
return $this->user;
4951
}
52+
53+
/**
54+
* @param mixed $value
55+
*/
56+
public function setAttribute(string $name, $value): void
57+
{
58+
$this->attributes[$name] = $value;
59+
}
60+
61+
/**
62+
* @param mixed $default
63+
*
64+
* @return mixed
65+
*/
66+
public function getAttribute(string $name, $default = null)
67+
{
68+
return $this->attributes[$name] ?: $default;
69+
}
5070
}

0 commit comments

Comments
 (0)
0