Quick links: Content - sections - sub sections
EN FR

Table of content

List of authentication drivers delivered with Jelix

Db

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:


cd lib/jelix-scripts/
php jelix.php --myapp installmodule jauthdb

# or if you want to add a default user "admin" at the same time, (with the password "admin")
php jelix.php --myapp installmodule -p defaultuser jauthdb

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"
password_crypt_function = "sha1"

dao option value must be a dao selector. 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.

  • login and password
  • getByLoginPassword (login, password)
  • getByLogin(login)
  • updatePassword(login,password)
  • deleteByLogin(login)
  • findByLogin(pattern)

Mandatory: database table associated with the dao must have "login" field as primary key or as a "UNIQUE" key.

You can add any other properties and methods to the dao.

Class

Clas 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"
password_crypt_function = "sha1"

LDS/MDS

This driver relies on an MDS server (http://mds.mandriva.org/, its previous name was LDS), and call its XML-RPC API. This driver authenticates through calls to this API.

auth.plugin.ini.php for a MDS driver:



driver= LDS

[LDS]
host=foo.com
port=80
login= foo
password= bar
scheme= https

LDS driver will call foo.com through port 80, with login foo and password bar, over a secured https connection.

ldap

This driver authenticates users registered in a directory services using LDAP. The configuration for the driver :



driver= ldap

[ldap]
; 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 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=

; name of the php function to crypt the password in the database
password_crypt_function = sha1
; if you want to use a salt with sha1:
;password_crypt_function = "1:sha1WithSalt"
;password_salt = "here_your_salt"

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 :-).