]> git.defcon.no Git - hermes/blobdiff - 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
diff --git a/api/lib/auth_plugins/permitall.php b/api/lib/auth_plugins/permitall.php
new file mode 100644 (file)
index 0000000..24a1ad4
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/*
+       permitall.php is a sample authentication plugin
+       that responds with 'accept' regardless of what
+       usernames and passwords are passed to it.
+
+       This plugin should serve as a sample plugin:
+       all authentication plugins must implement
+       all functions defined here.
+
+       NOTE that the auth-plugins are for authentication
+       only, and is not doing any kind of authorization.
+
+       NOTE that the auth-plugins handle user
+       authentication for API functions....
+
+*/
+
+// Is the backend readonly?
+function authmethod_readonly ()
+{
+       // Each auth-plugin must specify if users can
+       // be modified in the backend by responding to
+       // the authmethod_readonly with a true/false.
+       //
+       // By returning false to a readonly-poll, the
+       // plugin should be able to add users to the
+       // backend, and also must be able to change
+       // user data and passwords.
+       return true;
+}
+
+// Fetch user geckos (basic display info)
+function authuser_getinfo ( $username )
+{
+       $user['name']     = "Default User";
+       $user['email']    = "example@example.com";
+       return $user;
+}
+
+// Update geckos-info for user in backend
+function authuser_setinfo ( $username, $name, $email )
+{
+       // RW plugins should return false on failure,
+       // and true on success updating user information
+       // RO plugins should always return false
+       return false;
+}
+
+// Change a user-password in the backend
+function authuser_password ( $username, $password )
+{
+       // RW plugins should return false on failure,
+       // and true on success updating user information
+       // RO plugins should always return false
+       return false;
+}
+
+// Add a user to the backend
+function authuser_add ( $username, $name, $email, $password )
+{
+       // RW plugins should return false on failure,
+       // and true on success updating user information
+       // RO plugins should always return false
+       return false;
+}
+
+// Remove a user from the backend.
+function authuser_delete ( $username )
+{
+       // RW plugins should return false on failure,
+       // and true on success updating user information
+       // RO plugins should always return false
+       return false;
+}
+
+// Username+password verification. Basically "login"
+function authuser_verify ( $username, $password )
+{
+       // This plugin will always accept.
+       // A real plugin should naturally perform strong user
+       // verification. 
+       //
+       // Valid return values from this function:
+       //  * -1 -> Failure (e.g. backend not available)
+       //  * 0  -> username/password rejected
+       //  * 1  -> username/password accepted
+
+       return 1;
+}
+
+?>