Drizzled Public API Documentation

authentication.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Definitions required for Authentication plugin
00005  *
00006  *  Copyright (C) 2008 Sun Microsystems, Inc.
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; version 2 of the License.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 #pragma once
00023 
00024 #include <string>
00025 
00026 #include <drizzled/plugin.h>
00027 #include <drizzled/plugin/plugin.h>
00028 #include <drizzled/identifier.h>
00029 
00030 #include <drizzled/visibility.h>
00031 
00032 namespace drizzled
00033 {
00034 
00035 namespace identifier {
00036 class User;
00037 } 
00038 
00039 namespace plugin
00040 {
00041 
00042 class DRIZZLED_API Authentication : public Plugin
00043 {
00044   Authentication();
00045   Authentication(const Authentication &);
00046   Authentication& operator=(const Authentication &);
00047 public:
00048   explicit Authentication(std::string name_arg)
00049     : Plugin(name_arg, "Authentication")
00050   {}
00051   virtual ~Authentication() {}
00052 
00053   virtual bool authenticate(const identifier::User &sctx,
00054                             const std::string &passwd)= 0;
00055 
00056   static bool addPlugin(plugin::Authentication *auth);
00057   static void removePlugin(plugin::Authentication *auth);
00058   static bool isAuthenticated(drizzled::identifier::User::const_reference sctx,
00059                               const std::string &password);
00060 };
00061 
00062 } /* namespace plugin */
00063 } /* namespace drizzled */
00064