libzypp  17.31.31
authdata.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_MEDIA_AUTH_DATA_H
13 #define ZYPP_MEDIA_AUTH_DATA_H
14 
15 #include <zypp-core/Url.h>
16 #include <zypp-core/base/PtrTypes.h>
17 
18 namespace zypp {
19  namespace media {
20 
22 
23 
28 class AuthData
29 {
30 public:
32  {}
33 
34  AuthData(const Url & url);
35 
36  AuthData(const std::string & username, const std::string & password)
38  {}
39 
40  virtual ~AuthData() {};
41 
47  virtual bool valid() const;
48 
49  void setUrl(const Url & url) { _url = url; }
50  void setUsername(const std::string & username) { _username = username; }
51  void setPassword(const std::string & password) { _password = password; }
52 
53  Url url() const { return _url; }
54  std::string username() const { return _username; }
55  std::string password() const { return _password; }
56 
61  time_t lastDatabaseUpdate () const;
62  void setLastDatabaseUpdate ( time_t time );
63 
64  const std::map<std::string, std::string> &extraValues() const;
65  std::map<std::string, std::string> &extraValues();
66 
67  virtual std::ostream & dumpOn( std::ostream & str ) const;
68 
69  virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
70 
71 private:
73  std::string _username;
74  std::string _password;
75  time_t _lastChange; //< timestamp of the last change to the database this credential is stored in
76  std::map<std::string, std::string> _extraValues;
77 };
78 
79 typedef shared_ptr<AuthData> AuthData_Ptr;
80 std::ostream & operator << (std::ostream & str, const AuthData & auth_data);
81 
83 
84  } // namespace media
85 } // namespace zypp
86 
87 #endif // ZYPP_MEDIA_AUTH_DATA_H
void setLastDatabaseUpdate(time_t time)
Definition: authdata.cc:40
std::string password() const
Definition: authdata.h:55
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
void setPassword(const std::string &password)
Definition: authdata.h:51
std::map< std::string, std::string > _extraValues
Definition: authdata.h:76
virtual ~AuthData()
Definition: authdata.h:40
std::string _username
Definition: authdata.h:73
String related utilities and Regular expression matching.
time_t lastDatabaseUpdate() const
Definition: authdata.cc:35
virtual std::ostream & dumpOn(std::ostream &str) const
Definition: authdata.cc:55
void setUrl(const Url &url)
Definition: authdata.h:49
std::string username() const
Definition: authdata.h:54
Url url() const
Definition: authdata.h:53
Class for handling media authentication data.
Definition: authdata.h:28
virtual bool valid() const
Checks validity of authentication data.
Definition: authdata.cc:30
shared_ptr< AuthData > AuthData_Ptr
Definition: authdata.h:79
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Definition: authdata.cc:66
const std::map< std::string, std::string > & extraValues() const
Definition: authdata.cc:45
AuthData(const std::string &username, const std::string &password)
Definition: authdata.h:36
void setUsername(const std::string &username)
Definition: authdata.h:50
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
std::string _password
Definition: authdata.h:74
Url manipulation class.
Definition: Url.h:91