sql.txt 2.02 KB
Newer Older
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
1
2
3
4
5
6
7
8
9
10
`sqlauthBcrypt:SQL`
=============

This is an authentication module for authenticating a user against a SQL database. It uses bcrypt for validation of passwords against hashed passwords stored in the database. The implementation is based heavily on sqlauth:SQL.


Options
-------

`dsn`
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
11
:   The DSN which should be used to connect to the database server. Check the various database drivers in the [PHP documentation](http://php.net/manual/en/pdo.drivers.php) for a description of the various DSN formats.
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
12
13
14
15
16
17

`username`
:   The username which should be used when connecting to the database server.


`password`
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
18
:   The password which should be used when connecting to the database server. If you are running this locally for development and you are using an empty password, set this to the empty string ('').
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
19
20

`query`
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
21
:   The SQL query which should be used to retrieve the user. The parameters :username and :password are available. If the username/password is incorrect, the query should return no rows. The name of the columns in resultset will be used as attribute names. If the query returns multiple rows, they will be merged into the attributes. Duplicate values and NULL values will be removed.
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
22
23

`pepper`
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
24
:   The pepper string appended to the password before generating the hash. If you are not using a pepper, set this to the empty string ('').
Jesper Hvirring Henriksen's avatar
Jesper Hvirring Henriksen committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

`hash_column`
:   The column storing password hashes.

`salt_column`
:   The column storing password salts.


Examples
--------

Example - MySQL server:

    'bcrypt-example' => array(
      'sqlauthbcrypt:SQL',
      'dsn' => 'mysql:host=sql.example.org;dbname=simplesaml',
      'username' => 'userdb',
      'password' => 'secretpassword',
      'hash_column' => 'password_hash',
      'salt_column' => 'password_salt'
      'query' => 'SELECT username AS uid, name AS cn, email AS mail, password_hash, password_salt FROM users WHERE username = :username',
      'pepper' => '0474f00f7823ade7d10d6797b4ceb591672c3440d92537309cedfc383a98209daf6755c043deb92936797cf74859e6924d0b395a0309950be364928188c7cf0f',
    ),