libzypp 17.37.10

credentialmanager.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_MEDIA_AUTH_CREDENTIALMANAGER_H
13#define ZYPP_MEDIA_AUTH_CREDENTIALMANAGER_H
14
15#include <set>
16
17#include <zypp-core/Globals.h>
18#include <zypp-core/Pathname.h>
19#include <zypp-media/auth/AuthData>
20
22 namespace zypp
23{
24
25 class Url;
26
28 namespace media
29 {
30
31
33 //
34 // CLASS NAME : CredManagerOptions
35 //
39 struct ZYPP_API CredManagerOptions
40 {
41 CredManagerOptions(const Pathname & rootdir = "");
42
43 Pathname globalCredFilePath;
44 Pathname userCredFilePath;
45 Pathname customCredFileDir;
46 };
47
48
49 // comparator for CredentialSet
50 struct ZYPP_API AuthDataComparator
51 {
52 bool operator()(const AuthData_Ptr & lhs, const AuthData_Ptr & rhs) const;
53 };
54
56 //
57 // CLASS NAME : CredentialManager
58 //
63 class ZYPP_API CredentialManager
64 {
65 public:
66 using CredentialSet = std::set<AuthData_Ptr, AuthDataComparator>;
67 using CredentialSize = CredentialSet::size_type;
68 using CredentialIterator = CredentialSet::const_iterator;
69
70
71 CredentialManager(CredManagerOptions opts = CredManagerOptions());
72
73 ~CredentialManager()
74 {}
75
76 public:
88 AuthData_Ptr getCred(const Url & url);
89
93 AuthData_Ptr getCredFromFile(const Pathname & file);
94
98 void addGlobalCred(const AuthData & cred);
99
103 void addUserCred(const AuthData & cred);
104
119 void addCred(const AuthData & cred);
120
125 void save();
126
134 void saveInGlobal(const AuthData & cred);
135
143 void saveInUser(const AuthData & cred);
144
153 void saveInFile(const AuthData &, const Pathname & credFile);
154
160 void clearAll(bool global = false);
161
165 static AuthData_Ptr findIn( const CredentialManager::CredentialSet & set, const Url & url, url::ViewOption vopt );
166
170 time_t timestampForCredDatabase ( const zypp::Url &url );
171
172 CredentialIterator credsGlobalBegin() const;
173 CredentialIterator credsGlobalEnd() const;
174 CredentialSize credsGlobalSize() const;
175 bool credsGlobalEmpty() const;
176
177 CredentialIterator credsUserBegin() const;
178 CredentialIterator credsUserEnd() const;
179 CredentialSize credsUserSize() const;
180 bool credsUserEmpty() const;
181
182 struct Impl;
183 private:
184 RW_pointer<Impl> _pimpl;
185 };
186
187
188
190 } // media
193} // zypp
195
196#endif /* ZYPP_MEDIA_AUTH_CREDENTIALMANAGER_H */
Impl
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp::media::AuthData
Class for handling media authentication data.
Definition authdata.h:31
zypp::media::CredentialManager::~CredentialManager
~CredentialManager()
Definition credentialmanager.h:73
zypp::media::CredentialManager::CredentialManager
CredentialManager(CredManagerOptions opts=CredManagerOptions())
Definition credentialmanager.cc:328
zypp::media::CredentialManager::CredentialSet
std::set< AuthData_Ptr, AuthDataComparator > CredentialSet
Definition credentialmanager.h:66
zypp::media::CredentialManager::_pimpl
RW_pointer< Impl > _pimpl
Definition credentialmanager.h:184
zypp::media::CredentialManager::CredentialSize
CredentialSet::size_type CredentialSize
Definition credentialmanager.h:67
zypp::media::CredentialManager::CredentialIterator
CredentialSet::const_iterator CredentialIterator
Definition credentialmanager.h:68
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp::media::AuthData_Ptr
shared_ptr< AuthData > AuthData_Ptr
Definition authdata.h:81
zypp::url
Url details namespace.
Definition UrlBase.cc:58
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293
zypp::media::AuthDataComparator
Definition credentialmanager.h:51
zypp::media::AuthDataComparator::operator()
bool operator()(const AuthData_Ptr &lhs, const AuthData_Ptr &rhs) const
Definition credentialmanager.cc:52
zypp::media::CredManagerOptions
Definition credentialmanager.h:40
zypp::media::CredManagerOptions::globalCredFilePath
Pathname globalCredFilePath
Definition credentialmanager.h:43
zypp::media::CredManagerOptions::customCredFileDir
Pathname customCredFileDir
Definition credentialmanager.h:45
zypp::media::CredManagerOptions::CredManagerOptions
CredManagerOptions(const Pathname &rootdir="")
Definition credentialmanager.cc:71
zypp::media::CredManagerOptions::userCredFilePath
Pathname userCredFilePath
Definition credentialmanager.h:44
zypp::url::ViewOption
Url::asString() view options.
Definition UrlBase.h:41
Globals.h
Provides API related macros.
Pathname.h