Section: jAuth drivers
|^ jAuth : authentication system|
List of authentication drivers delivered with Jelix
Db driver authenticates users through database infos. This driver relies on a Dao which has to be indicated in the authentication configuration file.
Jelix provides a module, jauthdb, which contains a default dao. If you want to use it, you can install it:
php dev.php module:configure jauthdb # or if you want to add a default user "admin" at the same time, (with the password "admin") php dev.php module:configure -p defaultuser jauthdb # then php install/installer.php
The jauthdb installer will create a jlx_users table into your database. You can customize this table, add some fields and then provide an other dao file (see below).
In the configuration file of the plugin auth, you'll find something like that:
driver= Db [Db] dao = "jauthdb~jelixuser" profile=
dao option value must be a dao selector, and
profile may content a
specific profile for the jDb connection.
You can indicate any dao you want. But if you select one of your dao, be aware: it must have at least the same properties and methods defined into the jelixuser dao.
getByLoginPassword (login, password)
Mandatory: database table associated with the dao must have "login" field as primary key or as a "UNIQUE" key.
You can import the dao of jauthdb into your own dao to avoid to rewrite everything. You can add any other properties and methods to the dao.
Class driver is a more universal driver than Db driver. You just have to assign a class to it, in which you do... what you want! Except that it has to implement jIAuthDriverClass interface.
This class is considered as other business classes and therefore should be located in
classes/ folder of one of your modules.
auth.plugin.ini.php would declare:
driver= Class [Class] class = "mymodule~myclass"
This driver authenticates users registered in a directory services using LDAP. The configuration for the driver :
driver= ldap [ldap] ; profile in profiles.ini.php containing ldap connection informations profile=jauth ; following parameters can be stored in the profile too. ; LDAP search params ; search base, example for Active Directory: "ou=ADAM users,o=Microsoft,c=US" searchBaseDN= ; search filter, example for Active Directory: "(objectClass=user)" searchFilter= ; attributes to retrieve for the search, example for Active Directory: "cn,distinguishedName,name" searchAttributes=
In the profiles.ini.php, you should create a section for the profile indicated
profile property, in the category
authldap. The profile should
contain credentials to access to the ldap.
[authldap:jauth] ; default "localhost" hostname= ; default 389 port= ; DOMAIN\user or user@DOMAIN to connect with LDAP (user who has at least search right) ldapUser= ; password used to connect with LDAP ldapPassword= ; ldap protocol version protocolVersion=3 ; ldap property containing the user id uidProperty = cn ; the objectclass to use for a user ldapUserObjectClass= user
Create a driver ¶
If you have your own authentication system and you want to integrate it to Jelix, you will have to create your own driver.
authentication drivers creation page will give you an overview.
Once you are done, consider contributing it to Jelix. It will be gladly welcomed :-).