blob: 20749a7e08a68716a460759470ed18ef56122405 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Adldap\Connections;
4
5use Adldap\Auth\GuardInterface;
6use Adldap\Schemas\SchemaInterface;
7use Adldap\Configuration\DomainConfiguration;
8
9interface ProviderInterface
10{
11 /**
12 * Constructor.
13 *
14 * @param array|DomainConfiguration $configuration
15 * @param ConnectionInterface $connection
16 */
17 public function __construct($configuration, ConnectionInterface $connection);
18
19 /**
20 * Returns the current connection instance.
21 *
22 * @return ConnectionInterface
23 */
24 public function getConnection();
25
26 /**
27 * Returns the current configuration instance.
28 *
29 * @return DomainConfiguration
30 */
31 public function getConfiguration();
32
33 /**
34 * Returns the current Guard instance.
35 *
36 * @return \Adldap\Auth\Guard
37 */
38 public function getGuard();
39
40 /**
41 * Returns a new default Guard instance.
42 *
43 * @param ConnectionInterface $connection
44 * @param DomainConfiguration $configuration
45 *
46 * @return \Adldap\Auth\Guard
47 */
48 public function getDefaultGuard(ConnectionInterface $connection, DomainConfiguration $configuration);
49
50 /**
51 * Sets the current connection.
52 *
53 * @param ConnectionInterface $connection
54 *
55 * @return $this
56 */
57 public function setConnection(ConnectionInterface $connection = null);
58
59 /**
60 * Sets the current configuration.
61 *
62 * @param DomainConfiguration|array $configuration
63 *
64 * @throws \Adldap\Configuration\ConfigurationException
65 */
66 public function setConfiguration($configuration = []);
67
68 /**
69 * Sets the current LDAP attribute schema.
70 *
71 * @param SchemaInterface|null $schema
72 *
73 * @return $this
74 */
75 public function setSchema(SchemaInterface $schema = null);
76
77 /**
78 * Returns the current LDAP attribute schema.
79 *
80 * @return SchemaInterface
81 */
82 public function getSchema();
83
84 /**
85 * Sets the current Guard instance.
86 *
87 * @param GuardInterface $guard
88 *
89 * @return $this
90 */
91 public function setGuard(GuardInterface $guard);
92
93 /**
94 * Returns a new Model factory instance.
95 *
96 * @return \Adldap\Models\Factory
97 */
98 public function make();
99
100 /**
101 * Returns a new Search factory instance.
102 *
103 * @return \Adldap\Query\Factory
104 */
105 public function search();
106
107 /**
108 * Returns a new Auth Guard instance.
109 *
110 * @return \Adldap\Auth\Guard
111 */
112 public function auth();
113
114 /**
115 * Connects and Binds to the Domain Controller.
116 *
117 * If no username or password is specified, then the
118 * configured administrator credentials are used.
119 *
120 * @param string|null $username
121 * @param string|null $password
122 *
123 * @throws \Adldap\Auth\BindException If binding to the LDAP server fails.
124 * @throws ConnectionException If upgrading the connection to TLS fails
125 *
126 * @return ProviderInterface
127 */
128 public function connect($username = null, $password = null);
129}