]> git.defcon.no Git - hermes/blob - api/lib/auth_plugins/permitall.php
First stab at auth. Flow-changes to make things sort'a work
[hermes] / api / lib / auth_plugins / permitall.php
1 <?php
2 /*
3 permitall.php is a sample authentication plugin
4 that responds with 'accept' regardless of what
5 usernames and passwords are passed to it.
6
7 This plugin should serve as a sample plugin:
8 all authentication plugins must implement
9 all functions defined here.
10
11 NOTE that the auth-plugins are for authentication
12 only, and is not doing any kind of authorization.
13
14 NOTE that the auth-plugins handle user
15 authentication for API functions....
16
17 */
18
19 // Is the backend readonly?
20 function authmethod_readonly ()
21 {
22 // Each auth-plugin must specify if users can
23 // be modified in the backend by responding to
24 // the authmethod_readonly with a true/false.
25 //
26 // By returning false to a readonly-poll, the
27 // plugin should be able to add users to the
28 // backend, and also must be able to change
29 // user data and passwords.
30 return true;
31 }
32
33 // Fetch user geckos (basic display info)
34 function authuser_getinfo ( $username )
35 {
36 $user['name'] = "Default User";
37 $user['email'] = "example@example.com";
38 return $user;
39 }
40
41 // Update geckos-info for user in backend
42 function authuser_setinfo ( $username, $name, $email )
43 {
44 // RW plugins should return false on failure,
45 // and true on success updating user information
46 // RO plugins should always return false
47 return false;
48 }
49
50 // Change a user-password in the backend
51 function authuser_password ( $username, $password )
52 {
53 // RW plugins should return false on failure,
54 // and true on success updating user information
55 // RO plugins should always return false
56 return false;
57 }
58
59 // Add a user to the backend
60 function authuser_add ( $username, $name, $email, $password )
61 {
62 // RW plugins should return false on failure,
63 // and true on success updating user information
64 // RO plugins should always return false
65 return false;
66 }
67
68 // Remove a user from the backend.
69 function authuser_delete ( $username )
70 {
71 // RW plugins should return false on failure,
72 // and true on success updating user information
73 // RO plugins should always return false
74 return false;
75 }
76
77 // Username+password verification. Basically "login"
78 function authuser_verify ( $username, $password )
79 {
80 // This plugin will always accept.
81 // A real plugin should naturally perform strong user
82 // verification.
83 //
84 // Valid return values from this function:
85 // * -1 -> Failure (e.g. backend not available)
86 // * 0 -> username/password rejected
87 // * 1 -> username/password accepted
88
89 return 1;
90 }
91
92 ?>