Skip to content

Commit 440ada3

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

File tree

1 file changed

+21
-1
lines changed
  • src/Symfony/Component/Security/Http/Authenticator/Passport

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ 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
33-
* SelfValidatingPassport if no credentials should be checked.
35+
* SelfValidatingPassport if no credentials should be checked
3436
* @param BadgeInterface[] $badges
3537
*/
3638
public function __construct(UserInterface $user, CredentialsInterface $credentials, array $badges = [])
@@ -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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy