1
/* This file is part of the KDE project
3
(C) Copyright 2008 by Lorenzo Villani <lvillani@binaryhelix.net>
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#ifndef KEXIWEBFORMS_AUTH_AUTHENTICATOR_H
22
#define KEXIWEBFORMS_AUTH_AUTHENTICATOR_H
28
#include <pion/net/PionUser.hpp>
29
#include <pion/net/HTTPAuth.hpp>
33
namespace KexiWebForms {
37
* @brief Authenticator
39
* This service is responsible to show a the welcome page and a list of
40
* tables and queries in the database
44
static void init(pion::net::HTTPAuthPtr);
45
static Authenticator* getInstance();
47
virtual ~Authenticator() {}
50
* This method tries to load the user database, if nothing is found
51
* it creates a new table and fills it with two user accounts:
52
* - root: with password "root" and has access to all functionalities
53
* - anonymous: with password "guest" and has no access
58
* Authenticate the user based on user name and password
59
* @param char* username
60
* @param char* password
62
User authenticate(const char*, const char*);
65
* Authenticate the user based on user name and password
66
* @param std::string& username
67
* @param std::string& password
69
User authenticate(const std::string&, const std::string&);
72
* Authenticate the user based on PionUserPtr structure
73
* @param pion::net::PionUserPtr a boost::shared_ptr<PionUser> object
74
* @todo: Decouple this class from the pion library
76
User authenticate(pion::net::PionUserPtr);
80
Authenticator(pion::net::HTTPAuthPtr auth) : m_auth(auth) {}
83
static Authenticator* m_instance;
84
pion::net::HTTPAuthPtr m_auth;
88
} // end namespace Auth
89
} // end namespace KexiWebForms
91
#endif /* KEXIWEBFORMS_AUTH_AUTHENTICATOR_H */