1 | <?php |
||
31 | class MongoDb extends AbstractAdapter |
||
32 | { |
||
33 | /** |
||
34 | * @var \MongoDB\Driver\Manager |
||
35 | */ |
||
36 | protected $manager; |
||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $collection; |
||
41 | /** |
||
42 | * @var \MongoDB\Driver\ReadPreference |
||
43 | */ |
||
44 | protected $rp; |
||
45 | /** |
||
46 | * @var string The document field containing the username |
||
47 | */ |
||
48 | protected $fieldUser; |
||
49 | /** |
||
50 | * @var string The document field containing the password |
||
51 | */ |
||
52 | protected $fieldPass; |
||
53 | /** |
||
54 | * @var array Associative array to use to limit user accounts |
||
55 | */ |
||
56 | protected $query = []; |
||
57 | |||
58 | /** |
||
59 | * Creates a new MongoDB authentication adapter. |
||
60 | * |
||
61 | * @param \MongoDB\Driver\Manager $manager The manager |
||
62 | * @param string $collection The collection name (e.g. "mydb.emails") |
||
63 | * @param string $fieldUser The document field containing the username |
||
64 | * @param string $fieldPass The document field containing the hashed password |
||
65 | * @param array $query Optional associative array to use to limit user accounts |
||
66 | * @param \MongoDB\Driver\ReadPreference $rp Optional read preference |
||
67 | */ |
||
68 | 5 | public function __construct(\MongoDB\Driver\Manager $manager, string $collection, string $fieldUser, string $fieldPass, array $query = [], \MongoDB\Driver\ReadPreference $rp = null) |
|
77 | |||
78 | /** |
||
79 | * Authenticates the current principal using the provided credentials. |
||
80 | * |
||
81 | * This method expects two request body values to be available. These are |
||
82 | * `username` and `password`, as provided by the authenticating user. |
||
83 | * |
||
84 | * The principal details will include `ip` (remote IP address), `ua` (remote |
||
85 | * User Agent), and `ip` (MongoDB document `_id` field for user record). |
||
86 | * |
||
87 | * @param ServerRequestInterface $request The Server Request message containing credentials |
||
88 | * @return \Caridea\Auth\Principal An authenticated principal |
||
89 | * @throws \Caridea\Auth\Exception\MissingCredentials If the username or password is empty |
||
90 | * @throws \Caridea\Auth\Exception\UsernameNotFound if the provided username wasn't found |
||
91 | * @throws \Caridea\Auth\Exception\UsernameAmbiguous if the provided username matches multiple accounts |
||
92 | * @throws \Caridea\Auth\Exception\InvalidPassword if the provided password is invalid |
||
93 | * @throws \Caridea\Auth\Exception\ConnectionFailed if a MongoDB error is encountered |
||
94 | */ |
||
95 | 5 | public function login(ServerRequestInterface $request): \Caridea\Auth\Principal |
|
111 | |||
112 | /** |
||
113 | * Queries the MongoDB collection. |
||
114 | * |
||
115 | * @param string $username The username to use for parameter binding |
||
116 | * @param ServerRequestInterface $request The Server Request message (to use for additional parameter binding) |
||
117 | * @return \MongoDB\Driver\Cursor The results cursor |
||
118 | */ |
||
119 | 5 | protected function getResults(string $username, ServerRequestInterface $request): \MongoDB\Driver\Cursor |
|
127 | |||
128 | /** |
||
129 | * Fetches a single result from the Mongo Cursor. |
||
130 | * |
||
131 | * @param \MongoCursor $results The results |
||
132 | * @param string $username The attempted username (for Exception purposes) |
||
133 | * @return \stdClass A single MongoDB document |
||
134 | * @throws \Caridea\Auth\Exception\UsernameAmbiguous If there is more than 1 result |
||
135 | * @throws \Caridea\Auth\Exception\UsernameNotFound If there are 0 results |
||
136 | */ |
||
137 | 4 | protected function fetchResult(\MongoDB\Driver\Cursor $results, string $username): \stdClass |
|
147 | } |
||
148 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.