File indexing completed on 2024-05-12 05:46:53

0001 /*
0002  * Copyright 2009 by Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin St, Fifth Floor,
0017  * Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef PLASMA_AUTHORIZATIONMANAGER_P_H
0021 #define PLASMA_AUTHORIZATIONMANAGER_P_H
0022 
0023 #include "config-plasma.h"
0024 
0025 #include <QMap>
0026 #include <QString>
0027 
0028 #include <kconfiggroup.h>
0029 
0030 #include <authorizationmanager.h>
0031 #include <credentials.h>
0032 
0033 class QByteArray;
0034 
0035 namespace KWallet
0036 {
0037 class Wallet;
0038 } // namespace KWallet
0039 
0040 namespace Jolie
0041 {
0042 class Server;
0043 } // namespace Jolie
0044 
0045 namespace Plasma
0046 {
0047 
0048 class AuthorizationInterface;
0049 class AuthorizationRule;
0050 class Credentials;
0051 
0052 class AuthorizationManagerPrivate
0053 {
0054 public:
0055     AuthorizationManagerPrivate(AuthorizationManager *manager);
0056     ~AuthorizationManagerPrivate();
0057 
0058     void prepareForServiceAccess();
0059     void prepareForServicePublication();
0060     void slotWalletOpened();
0061     void slotLoadRules();
0062     AuthorizationRule *matchingRule(const QString &serviceName, const Credentials &key) const;
0063     Credentials getCredentials(const QString &id = QString());
0064     void addCredentials(const Credentials &identity);
0065     void saveRules();
0066 
0067     AuthorizationManager        *q;
0068     Jolie::Server               *server;
0069     AuthorizationManager::AuthorizationPolicy
0070     authorizationPolicy;
0071     AuthorizationInterface      *authorizationInterface;
0072     AuthorizationInterface      *customAuthorizationInterface;
0073     KWallet::Wallet             *wallet;
0074 
0075     Credentials                 myCredentials;
0076     QMap<QString, Credentials>  identities;
0077     QList<AuthorizationRule *>   rules;
0078     KConfigGroup                identitiesConfig;
0079     KConfigGroup                rulesConfig;
0080     bool                        locked;
0081 };
0082 
0083 }
0084 
0085 #endif // PLASMA_AUTHORIZATIONMANAGER_P_H