plugin:authpdo
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
plugin:authpdo [2016-08-03 22:15] – [General Settings] uwe.kuhmann | plugin:authpdo [2018-05-03 19:07] – Aleksandr | ||
---|---|---|---|
Line 7: | Line 7: | ||
type : auth | type : auth | ||
lastupdate : 2016-01-30 | lastupdate : 2016-01-30 | ||
- | compatible : detritus | + | compatible : (bundled) |
depends | depends | ||
conflicts | conflicts | ||
Line 22: | Line 22: | ||
This plugin allows to configure your wiki to authenticate against an existing database using PHP's PDO extension. Typical use cases are integrating DokuWiki with a web forum, blog or bug tracker. | This plugin allows to configure your wiki to authenticate against an existing database using PHP's PDO extension. Typical use cases are integrating DokuWiki with a web forum, blog or bug tracker. | ||
+ | |||
+ | |||
+ | ===== Real World Examples ===== | ||
+ | |||
+ | Before you go forward to [[# | ||
+ | |||
+ | * [[plugin: | ||
+ | * [[plugin: | ||
+ | * [[plugin: | ||
+ | * [[plugin: | ||
+ | |||
===== Configuration ===== | ===== Configuration ===== | ||
Line 27: | Line 38: | ||
To configure this plugin, some experience with database queries and the SQL query language is required. Sample configurations for popular systems will soon be provided by the community. | To configure this plugin, some experience with database queries and the SQL query language is required. Sample configurations for popular systems will soon be provided by the community. | ||
- | The configuration consists mostly of SQL statements to access your database. The plugin itself is completely database agnostic. You can use it to access any database supported by PDO - refer to [[http:// | + | The configuration consists mostly of SQL statements to access your database. The plugin itself is completely database agnostic. You can use it to access any database supported by PDO -- refer to [[http:// |
In most of the statements named PDO placeholders are used (colon prefixed alphanumeric). These represent the actual data that will be inserted into the statement. The PDO driver takes care of proper escaping - you do not have to worry about it. | In most of the statements named PDO placeholders are used (colon prefixed alphanumeric). These represent the actual data that will be inserted into the statement. The PDO driver takes care of proper escaping - you do not have to worry about it. | ||
Line 34: | Line 45: | ||
Each option below comes with an example that shows how the statement would look for a fictive [[#example database]] given at the end of this page. | Each option below comes with an example that shows how the statement would look for a fictive [[#example database]] given at the end of this page. | ||
+ | |||
==== General Settings ==== | ==== General Settings ==== | ||
+ | |||
=== Option ' | === Option ' | ||
This setting will output detailed error messages whenever something goes wrong. You most probably want to enable this during the initial configuration of the plugin. Once everything works you should definitely disable this again as it may leak important information to possible attackers. | This setting will output detailed error messages whenever something goes wrong. You most probably want to enable this during the initial configuration of the plugin. Once everything works you should definitely disable this again as it may leak important information to possible attackers. | ||
+ | |||
=== Option ' | === Option ' | ||
Line 57: | Line 71: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | |||
=== Option ' | === Option ' | ||
This option configures the user to use to connect to the database. You can leave it empty for sqlite databases. | This option configures the user to use to connect to the database. You can leave it empty for sqlite databases. | ||
+ | |||
=== Option ' | === Option ' | ||
This is the password for above user. You can leave it empty for sqlite databases. | This is the password for above user. You can leave it empty for sqlite databases. | ||
+ | |||
==== Related Core Settings ==== | ==== Related Core Settings ==== | ||
Line 70: | Line 87: | ||
There are a couple of settings you most probably want to tune when enabling authpdo: | There are a couple of settings you most probably want to tune when enabling authpdo: | ||
- | * [[config: | + | * [[config: |
- | * [[config: | + | * [[config: |
- | * [[config: | + | * [[config: |
+ | * [[config: | ||
==== Minimal SQL Setup ==== | ==== Minimal SQL Setup ==== | ||
This plugin gains more capabilities the more of the configuration you fill in. You can leave out configuration at the expense of functionality. However a few statements are required to have minimal login functionality: | This plugin gains more capabilities the more of the configuration you fill in. You can leave out configuration at the expense of functionality. However a few statements are required to have minimal login functionality: | ||
+ | |||
=== Option ' | === Option ' | ||
Line 82: | Line 102: | ||
This statement is used to get a single user from the database. This statement should return exactly one row if the user exists. Or no row if it doesn' | This statement is used to get a single user from the database. This statement should return exactly one row if the user exists. Or no row if it doesn' | ||
- | ^ Guaranteed Placeholders | + | ^ Guaranteed Placeholders |
- | | '': | + | | '': |
- | ^ Mandatory fields to return | + | ^ Mandatory fields to return |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | | '' | + | | '' |
- | ^ Optional fields to return | + | ^ Optional fields to return |
- | | '' | + | | '' |
Example: | Example: | ||
Line 102: | Line 122: | ||
WHERE " | WHERE " | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 122: | Line 143: | ||
AND m." | AND m." | ||
</ | </ | ||
+ | |||
+ | |||
+ | === Option ' | ||
+ | |||
+ | :!: If your database uses one of the [[config: | ||
+ | |||
+ | This statement is used to check the password a user is providing upon login. | ||
+ | |||
+ | When you set up this setting, your '' | ||
+ | |||
+ | This statement should return a single row on success and no rows on failure. | ||
+ | |||
+ | ^ Guaranteed Placeholders ^^ | ||
+ | | '': | ||
+ | | '': | ||
+ | | '': | ||
+ | ^ Optional Placeholders ^^ | ||
+ | | '' | ||
+ | |||
+ | Example: | ||
+ | <code tsql> | ||
+ | SELECT uid | ||
+ | FROM user | ||
+ | WHERE login = :user | ||
+ | AND pass = MD5(CONCAT(MD5(user), | ||
+ | </ | ||
+ | |||
==== Additional SQL Setup ==== | ==== Additional SQL Setup ==== | ||
Line 187: | Line 235: | ||
| | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 201: | Line 250: | ||
DELETE FROM " | DELETE FROM " | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 208: | Line 258: | ||
^ Guaranteed Placeholders ^^ | ^ Guaranteed Placeholders ^^ | ||
| '': | | '': | ||
- | | '': | + | | '': |
| '': | | '': | ||
| '': | | '': | ||
- | | '': | + | | '': |
- | | '': | + | | '': |
- | | '': | + | | '': |
^ Mandatory fields to return ^^ | ^ Mandatory fields to return ^^ | ||
| '' | | '' | ||
Line 232: | Line 282: | ||
LIMIT : | LIMIT : | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 239: | Line 290: | ||
^ Guaranteed Placeholders ^^ | ^ Guaranteed Placeholders ^^ | ||
| '': | | '': | ||
- | | '': | + | | '': |
| '': | | '': | ||
| '': | | '': | ||
^ Mandatory fields to return ^^ | ^ Mandatory fields to return ^^ | ||
- | | '' | + | | '' |
<code tsql> | <code tsql> | ||
Line 258: | Line 308: | ||
AND U." | AND U." | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 275: | Line 326: | ||
WHERE " | WHERE " | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 296: | Line 348: | ||
WHERE " | WHERE " | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 315: | Line 368: | ||
WHERE " | WHERE " | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 327: | Line 381: | ||
| | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 343: | Line 398: | ||
| | ||
</ | </ | ||
+ | |||
=== Option ' | === Option ' | ||
Line 359: | Line 415: | ||
AND " | AND " | ||
</ | </ | ||
+ | |||
===== Example Database ===== | ===== Example Database ===== | ||
Line 366: | Line 423: | ||
{{ : | {{ : | ||
- | < | + | < |
CREATE TABLE user ( | CREATE TABLE user ( | ||
" | " | ||
Line 384: | Line 441: | ||
); | ); | ||
</ | </ | ||
+ | |||
===== A Warning on MySQL MyISAM ===== | ===== A Warning on MySQL MyISAM ===== |
plugin/authpdo.txt · Last modified: 2020-10-31 18:31 by webtist_hanschur