1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2011 Brian Aker
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
#include <boost/program_options.hpp>
30
#include <drizzled/configmake.h>
31
#include <drizzled/plugin/authentication.h>
32
#include <drizzled/identifier.h>
33
#include <drizzled/util/convert.h>
34
#include <drizzled/module/option_map.h>
36
namespace po= boost::program_options;
37
namespace fs= boost::filesystem;
40
using namespace drizzled;
45
static bool opt_allow_anonymous;
47
class AuthAll: public plugin::Authentication
52
plugin::Authentication("auth_all")
59
* Base class method to check authentication for a user.
61
bool authenticate(const identifier::User &sctx, const string &)
63
if (not opt_allow_anonymous)
65
if (sctx.username().empty())
73
static int init(module::Context &context)
75
context.add(new AuthAll());
80
static void init_options(drizzled::module::option_context &context)
82
context("allow_anonymous",
83
po::value<bool>(&opt_allow_anonymous)->default_value(false),
84
N_("Allow anonymous access"));
88
} /* namespace auth_all */
90
DRIZZLE_DECLARE_PLUGIN
93
"Allow-All-Authentication",
96
"Data Dictionary for utility tables",
100
auth_all::init_options
102
DRIZZLE_DECLARE_PLUGIN_END;