差分
このページの2つのバージョン間の差分を表示します。
| dokuwiki:ja:howto [2006/11/21] – 作成 administrator | dokuwiki:ja:howto [2022/03/12] (現在) – 外部編集 127.0.0.1 | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== 認証方法の記述法 ====== | ||
| + | [[wiki: | ||
| + | |||
| + | If none of the provided [[backends]] does not do what you want you can simply create your own one. Backends are stored in the '' | ||
| + | |||
| + | In your class you need to override a few methods and set some public fields from the [[http:// | ||
| + | |||
| + | If you write a new backend be sure to share your code with the community! | ||
| + | |||
| + | ===== Fields to set ===== | ||
| + | |||
| + | ==== $success ==== | ||
| + | |||
| + | This simple boolean needs to be set to //true// in your constructor if your auth module was correctly initialized. Use this to notify the frontend if anything went wrong by setting it to //false//. | ||
| + | |||
| + | ==== $cando ==== | ||
| + | |||
| + | The $cando field is an associative array of booleans. You need to set the array fields to //true// for all functions your backend provides. Here is a list of keys in $cando and their meaning: | ||
| + | |||
| + | | addUser | ||
| + | | delUser | ||
| + | | modLogin | ||
| + | | modPass | ||
| + | | modName | ||
| + | | modMail | ||
| + | | modGroups | ||
| + | | getUsers | ||
| + | | getUserCount| can the number of users be retrieved? | | ||
| + | | getGroups | ||
| + | | external | ||
| + | | logoff | ||
| + | |||
| + | ===== Required Methods | ||
| + | |||
| + | Only two functions need to be implemented. But the more you do the more the frontend will be able to do. | ||
| + | |||
| + | ==== Constructor ==== | ||
| + | |||
| + | Well your class should have a constructor of course :-) Set the fields mentioned above here. | ||
| + | |||
| + | ==== checkPass() ==== | ||
| + | |||
| + | This function need to check if the given user exists and the given plaintext password is correct. | ||
| + | |||
| + | ==== getUserData() ==== | ||
| + | |||
| + | Used to return user information like email address and real name. | ||
| + | |||
| + | ===== Optional Methods ===== | ||
| + | |||
| + | All these methods are optional and will only be called if the appropriate [[#cando]] fields are set | ||
| + | |||
| + | ==== trustExternal() ==== | ||
| + | |||
| + | If $cando[' | ||
| + | |||
| + | The function can be used to authenticate against third party cookies or Apache auth mechanisms and replaces the '' | ||
| + | |||
| + | Have a look at the [[punbb]] backend for an example usage of this function. | ||
| + | |||
| + | If this function is implemented you may omit all other functions from your module (even the required ones above - except for the constructor of course). | ||
| + | |||
| + | ==== logOff() ==== | ||
| + | |||
| + | If $cando[' | ||
| + | |||
| + | ==== createUser() ==== | ||
| + | |||
| + | Creates a user with the provided data. | ||
| + | |||
| + | ==== modifyUser() ==== | ||
| + | |||
| + | Modifies a user's data. | ||
| + | |||
| + | ==== deleteUser() ==== | ||
| + | |||
| + | Deletes one or more users. | ||
| + | |||
| + | ==== getUserCount() ==== | ||
| + | |||
| + | Returns the number of users matching certain filter criteria. | ||
| + | |||
| + | ==== retieveUsers() ==== | ||
| + | |||
| + | Fetches userdata for multiple users matching a certain filter criteria. | ||
| + | |||
| + | ==== addGroup() ==== | ||
| + | |||
| + | Creates a new Group | ||
| + | |||
| + | ==== retrieveGroups() ==== | ||
| + | |||
| + | List all available groups | ||