libzypp  17.36.3
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  //
40  {
41  CredManagerOptions(const Pathname & rootdir = "");
42 
46  };
48 
49  // comparator for CredentialSet
51  {
52  bool operator()(const AuthData_Ptr & lhs, const AuthData_Ptr & rhs) const;
53  };
54 
56  //
57  // CLASS NAME : CredentialManager
58  //
64  {
65  public:
66  using CredentialSet = std::set<AuthData_Ptr, AuthDataComparator>;
68  using CredentialIterator = CredentialSet::const_iterator;
69 
70 
72 
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:
185  };
187 
188 
190  } // media
193 } // zypp
195 
196 #endif /* ZYPP_MEDIA_AUTH_CREDENTIALMANAGER_H */
CredentialSet::const_iterator CredentialIterator
Provides API related macros.
Url::asString() view options.
Definition: UrlBase.h:40
CredentialSet::size_type CredentialSize
std::set< AuthData_Ptr, AuthDataComparator > CredentialSet
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition: ResTraits.h:93
shared_ptr< AuthData > AuthData_Ptr
Definition: authdata.h:81
Class for handling media authentication data.
Definition: authdata.h:30
zypp::Url Url
Definition: url.h:15
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
SolvableIdType size_type
Definition: PoolMember.h:126
Url manipulation class.
Definition: Url.h:92