summaryrefslogtreecommitdiffstats
path: root/auth/eurephia_authplugin_driver.h
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2013-03-03 00:46:23 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2013-03-03 00:58:09 +0100
commit25e5147c7d3e16ec96713c214dc28e398b3be10c (patch)
treeb43c9612580f7070608a8848727cc5a358f0a5a8 /auth/eurephia_authplugin_driver.h
parent262442599d5352f8c48018d975b7f50a53dab33c (diff)
downloadeurephia-25e5147c7d3e16ec96713c214dc28e398b3be10c.tar.gz
eurephia-25e5147c7d3e16ec96713c214dc28e398b3be10c.tar.xz
eurephia-25e5147c7d3e16ec96713c214dc28e398b3be10c.zip
Added the first stab of an authentication plug-in framework
This enables a run-time loadable support for other authentication modules. This can be used to make eurephia authenticate user's passwords against other sources than the local eurephia database itself. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'auth/eurephia_authplugin_driver.h')
-rw-r--r--auth/eurephia_authplugin_driver.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/auth/eurephia_authplugin_driver.h b/auth/eurephia_authplugin_driver.h
new file mode 100644
index 0000000..02211d2
--- /dev/null
+++ b/auth/eurephia_authplugin_driver.h
@@ -0,0 +1,100 @@
+/* eurephia_authplugin_driver.h
+ *
+ * Copyright (C) 2013 David Sommerseth <dazo@users.sourceforge.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/**
+ * @file eurephia_authplugin_driver.h
+ * @author David Sommerseth <dazo@users.sourceforge.net>
+ * @date 2013-02-15
+ *
+ * @brief Authentication plug-in framework for eurephia
+ */
+
+#ifndef EUREPHIA_AUTHPLUGIN_DRIVER_H_
+#define EUREPHIA_AUTHPLUGIN_DRIVER_H_
+
+typedef enum { eAUTH_FAILED, /**< Authentication failed */
+ eAUTH_SUCCESS, /**< Authentication successful */
+ eAUTH_PLGERROR /**< An error occured in the auth plug-in */
+} eAuthResStatus;
+
+/**
+ * Result type for authentication plug-ins
+ */
+typedef struct __eAuthResult {
+ eAuthResStatus status;
+ char *msg;
+} eAuthResult;
+
+
+/**
+ * Authentication plug-in API
+ */
+typedef struct __eAuthPlugin {
+ /**
+ * Returns the API version of the authentication plug-in. Used to
+ * ensure the core eurephia framework is compatible with the auth plug-in
+ *
+ * @return An integer with the defined auth plug-in API level support.
+ */
+ unsigned int (*APIversion)(); // Mandatory
+
+ /**
+ * Returns information about the authentication plug-in. Used for
+ * informative log messages
+ *
+ */
+ char * (*PluginInfo)(); // Mandatory
+
+ /**
+ * Mandatory auth plug-in function. Authenticates a user account based
+ * on the given username and password.
+ *
+ * @param eurephiaCTX* Pointer to the current eurephia context
+ * @param username* String pointer to the username for the authentication
+ * @param password* String pointer to the password for the authentication
+ *
+ * @returns On success it returns a pointer to an eAuthResult struct, which
+ * contains further information on the success of the authentication.
+ * On system failure, NULL is returned.
+ */
+ eAuthResult * (*AuthenticateUser)(eurephiaCTX *ctx,
+ const char *username,
+ const char *password);
+
+ /**
+ * ChangePassword() is only enabled if allowed by config and supported
+ * by (optionally) by the plug-in. The eurephia context must be in
+ * an admin mode for this to be enabled.
+ *
+ * @param eurephiaCTX* Pointer to the current eurephia context
+ * @param username* String pointer to the username account for the password change
+ * @param oldpwd* String pointer to the old password, for authentication
+ * @param newpwd* String pointer to the new password
+ *
+ * @returns On success it returns a pointer to an eAuthResult struct, which
+ * contains further information on the success of the authentication.
+ * On system failure, NULL is returned.
+ */
+ eAuthResult * (*ChangePassword)(eurephiaCTX *ctx,
+ const char *username,
+ const char *oldpwd,
+ const char *newpwd);
+} eAuthPlugin;
+
+#endif /* EUREPHIA_AUTHPLUGIN_DRIVER_H_ */