Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 532f031

Browse files
committed
Working on more documentation.
1 parent 073d0f8 commit 532f031

File tree

3 files changed

+101
-15
lines changed

3 files changed

+101
-15
lines changed

docs/auth/installation.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Auth Driver
22

3-
The Adldap Laravel auth driver allows you to seamlessly authenticate AD users,
3+
The Adldap2 Laravel auth driver allows you to seamlessly authenticate LDAP users,
44
as well as have a local database record of the user.
55

66
This allows you to easily attach information to the users account
77
as you would a regular laravel application.
88

9-
> **Note**: The Adldap auth driver actually extends from and utilizes Laravel's eloquent auth driver.
109

1110
## Installation
1211

@@ -65,10 +64,9 @@ Change the `driver` value inside the `users` authentication provider to `adldap`
6564
Inside your `config/adldap_auth.php` file there is a configuration option named `usernames`.
6665

6766
This array contains the `ldap` attribute you use for authenticating users, as well
68-
as the `eloquent` attribute for locating the LDAP users model.
67+
as the `eloquent` attribute for locating the LDAP users local model.
6968

7069
```php
71-
7270
'usernames' => [
7371

7472
'ldap' => 'userprincipalname',
@@ -86,7 +84,6 @@ If you're using a `username` field instead of `email` in your application, you w
8684
For example, if you'd like to login users by their `samaccountname`:
8785

8886
```php
89-
9087
'usernames' => [
9188

9289
'ldap' => 'samaccountname',
@@ -101,7 +98,7 @@ Be sure to update the `sync_attributes` option to synchronize the users `usernam
10198
```php
10299
'sync_attributes' => [
103100

104-
'username' => 'samaccountname', // Changed from 'email' => 'userprincipalname'
101+
'username' => 'samaccountname',
105102
'name' => 'cn',
106103

107104
],
@@ -129,4 +126,4 @@ public function login(Request $request)
129126
return redirect()->to('login')
130127
->withMessage('Hmm... Your username or password is incorrect');
131128
}
132-
```
129+
```

docs/auth/upgrading.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Upgrading From 2.* to 3.*
2+
3+
## Upgrade
4+
5+
**Estimated Upgrade Time: 1 hour**
6+
7+
There are significant changes to the code base from `v2` to `v3`.
8+
9+
### Configuration
10+
11+
1. Delete your `config/adldap_auth.php`
12+
2. Run `php artisan vendor:publish --tag="adldap"`
13+
3. Reconfigure auth driver in `config/adldap_auth.php`
14+
15+
#### Username Attribute
16+
17+
The username attribute has been renamed to the `usernames` array.
18+
19+
You must specify your LDAP login attribute as well as your `eloquent` attribute.
20+
21+
```php
22+
// v2.0
23+
24+
'username_attribute' => ['email' => 'mail'],
25+
26+
// v3.0
27+
28+
'usernames' => [
29+
'ldap' => 'mail',
30+
31+
'eloquent' => 'email',
32+
],
33+
```
34+
35+
#### Login Attribute
36+
37+
The configuration option `login_attribute` has been removed in favor
38+
of the `ldap` option inside the `usernames` array.
39+
40+
#### Binding Users to Model
41+
42+
If you were using the `bind_user_to_model` option, you previously inserted
43+
the following trait onto your `User` model:
44+
45+
```php
46+
Adldap\Laravel\Traits\AdldapUserModelTrait
47+
```
48+
49+
You must replace this with:
50+
51+
```php
52+
Adldap\Laravel\Traits\HasLdapUser
53+
```
54+
55+
For example:
56+
57+
```php
58+
use Adldap\Laravel\Traits\HasLdapUser;
59+
use Illuminate\Foundation\Auth\User as Authenticatable;
60+
61+
class User extends Authenticatable
62+
{
63+
use HasLdapUser;
64+
```
65+
66+
The configuration option itself (inside `config/adldap_auth.php`) has
67+
been removed in favor of utilizing the trait itself instead.
68+
69+
#### Limitation Filter
70+
71+
If you were using the `limitation_filter` option, this has been replaced with the `scopes` option.
72+
73+
> **Note**: For more about this option, please read the [documentation](scopes.md).
74+
75+
You must create and define a query scope that includes your filter. For example:
76+
77+
```php
78+
namespace App\Ldap\Scopes;
79+
80+
use Adldap\Laravel\Scopes\ScopeInterface;
81+
82+
class LimitationScope implements ScopeInterface
83+
{
84+
public function apply($query)
85+
{
86+
$query->rawFilter('(cn=John Doe)');
87+
}
88+
}
89+
```
90+
91+
#### Select Attributes
92+
93+
The configuration option `select_attributes` has been removed.
94+
95+
If you would like to limit the attributes for the query on your LDAP
96+
server when locating users, please use a [Scope](scopes.md).

readme.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Adldap2 - Laravel allows easy configuration, access, management and authenticati
1717
* [Installation](#installation)
1818
* [Usage](#usage)
1919
* [Auth Driver](#auth-driver)
20+
* [Upgrading](docs/auth/upgrading.md)
2021
* [Quick Start - From Scratch](docs/quick-start.md)
2122
* [Installation & Basic Setup](docs/auth/installation.md)
2223
* Features
@@ -125,11 +126,3 @@ class UserController extends Controller
125126
```
126127

127128
To see more usage in detail, please visit the [Adldap2 Repository](http://github.com/Adldap2/Adldap2).
128-
129-
## Upgrading From 2.* to 3.*
130-
131-
If using the Adldap2 auth driver, please follow these steps:
132-
133-
1. Delete your `config/adldap_auth.php`
134-
2. Run `php artisan vendor:publish --tag="adldap"`
135-
3. Reconfigure auth driver in `config/adldap_auth.php`

0 commit comments

Comments
 (0)