Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann committed May 25, 2015
1 parent dfd8742 commit 5dd6178
Showing 1 changed file with 58 additions and 15 deletions.
73 changes: 58 additions & 15 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,58 @@ A Silex Ldap authentication service provider
[![Build Status](https://travis-ci.org/DerManoMann/ldap-auth-service-provider.png)](https://travis-ci.org/DerManoMann/ldap-auth-service-provider)
[![Coverage Status](https://coveralls.io/repos/DerManoMann/ldap-auth-service-provider/badge.png)](https://coveralls.io/r/DerManoMann/ldap-auth-service-provider)


This service provider provides Ldap based authentication and authorization.

Requies Silex 2.0.

## Features

TODO

## Basic Usage

```php
// register service with name ldap
$ldapAuth = 'ldap';
$app->register(new LdapAuthenticationServiceProvider($ldapAuth));

// configure firewalls
$app->register(new SecurityServiceProvider(), array(
'security.firewalls' => array(
'login' => array(
'pattern' => '^/login$',
),
'default' => array(
'pattern' => '^.*$',
'anonymous' => true,
$ldapAuth => array(
// form options
'check_path' => '/login_check_ldap',
'require_previous_session' => false,
// auth options
'auth' => array(
'entryPoint' => 'form',
),
// ldap options
'ldap' => array(
'host' => 'localhost',
'username' => 'username-for-initial-bind',
'password' => 'xxx',

),
),
'users' => function () use ($app, $ldapAuth) {
return new LdapUserProvider(
$ldapAuth,
$app['security.ldap.default.ldap'],
$app['logger'],
array(
'roles' => array(
'CN=Development,OU=Groups,DC=radebatz,DC=net' => 'ROLE_USER',
'CN=Admins,OU=Groups,DC=radebatz,DC=net' => 'ROLE_ADMIN',
),
'baseDn' => 'DC=radebatz,DC=net',
)
);
},
),
),

```

## Installation

Expand All @@ -29,18 +72,18 @@ run the `php composer.phar install` command to install it:
Alternatively, you can download the [`ldap-auth-service-provider.zip`][1] file and extract it.


## Usage
### Configuring Ldap
The Ldap related code depends on [`zend-ldap`](https://github.com/zendframework/zend-ldap), so all configuration options are just passed through.
For more details check the [`zend-ldap docs`](http://framework.zend.com/manual/current/en/index.html#zend-ldap).

### Register per firewall
$app->register(new LdapAuthenticationServiceProvider(), $options);

### Custom user class
The LdapUserProvider class allows to configure a custom User class to be used. Only restriction is that the custom class has a constructor that is compatible with the default class `Symfony\\Component\\Security\\Core\\User\\User`.

### Configuring Ldap
-> link to zend ldap docs

### Custom user class
-> constructor compatible with sf security User class
TODO
## Requirements
- Silex 2.0
- PHP 5.5


## License
Expand Down

0 comments on commit 5dd6178

Please sign in to comment.