libzypp 17.31.23
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
18namespace zypp {
19 namespace media {
20
22
23
29{
30public:
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
71private:
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
79typedef shared_ptr<AuthData> AuthData_Ptr;
80std::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
Url manipulation class.
Definition: Url.h:92
Class for handling media authentication data.
Definition: authdata.h:29
virtual std::ostream & dumpAsIniOn(std::ostream &str) const
Definition: authdata.cc:66
std::string password() const
Definition: authdata.h:55
time_t lastDatabaseUpdate() const
Definition: authdata.cc:35
void setUsername(const std::string &username)
Definition: authdata.h:50
virtual bool valid() const
Checks validity of authentication data.
Definition: authdata.cc:30
Url url() const
Definition: authdata.h:53
void setPassword(const std::string &password)
Definition: authdata.h:51
void setLastDatabaseUpdate(time_t time)
Definition: authdata.cc:40
virtual ~AuthData()
Definition: authdata.h:40
std::map< std::string, std::string > _extraValues
Definition: authdata.h:76
AuthData(const std::string &username, const std::string &password)
Definition: authdata.h:36
virtual std::ostream & dumpOn(std::ostream &str) const
Definition: authdata.cc:55
void setUrl(const Url &url)
Definition: authdata.h:49
const std::map< std::string, std::string > & extraValues() const
Definition: authdata.cc:45
std::string _username
Definition: authdata.h:73
std::string username() const
Definition: authdata.h:54
std::string _password
Definition: authdata.h:74
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
shared_ptr< AuthData > AuthData_Ptr
Definition: authdata.h:79
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2