libzypp 17.37.10

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#include <utility>
19
20 namespace zypp {
21 namespace media {
22
24
25
30 class ZYPP_API AuthData
31{
32 public:
33 AuthData()
34 {}
35
36 AuthData(const Url & url);
37
38 AuthData(std::string username, std::string password)
39 : _username(std::move(username)), _password(std::move(password)), _lastChange(0)
40 {}
41
42 virtual ~AuthData() {};
43
49 virtual bool valid() const;
50
51 void setUrl(const Url & url) { _url = url; }
52 void setUsername(const std::string & username) { _username = username; }
53 void setPassword(const std::string & password) { _password = password; }
54
55 Url url() const { return _url; }
56 std::string username() const { return _username; }
57 std::string password() const { return _password; }
58
63 time_t lastDatabaseUpdate () const;
64 void setLastDatabaseUpdate ( time_t time );
65
66 const std::map<std::string, std::string> &extraValues() const;
67 std::map<std::string, std::string> &extraValues();
68
69 virtual std::ostream & dumpOn( std::ostream & str ) const;
70
71 virtual std::ostream & dumpAsIniOn( std::ostream & str ) const;
72
73 private:
74 Url _url;
75 std::string _username;
76 std::string _password;
77 time_t _lastChange; //< timestamp of the last change to the database this credential is stored in
78 std::map<std::string, std::string> _extraValues;
79};
80
81 using AuthData_Ptr = shared_ptr<AuthData>;
82std::ostream & operator << (std::ostream & str, const AuthData & auth_data);
83
85
86 } // namespace media
87} // namespace zypp
88
89#endif // ZYPP_MEDIA_AUTH_DATA_H
shared_ptr
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::media::AuthData
Class for handling media authentication data.
Definition authdata.h:31
zypp::media::AuthData::AuthData
AuthData(std::string username, std::string password)
Definition authdata.h:38
zypp::media::AuthData::password
std::string password() const
Definition authdata.h:57
zypp::media::AuthData::setUsername
void setUsername(const std::string &username)
Definition authdata.h:52
zypp::media::AuthData::_url
Url _url
Definition authdata.h:74
zypp::media::AuthData::url
Url url() const
Definition authdata.h:55
zypp::media::AuthData::setPassword
void setPassword(const std::string &password)
Definition authdata.h:53
zypp::media::AuthData::_lastChange
time_t _lastChange
Definition authdata.h:77
zypp::media::AuthData::~AuthData
virtual ~AuthData()
Definition authdata.h:42
zypp::media::AuthData::_extraValues
std::map< std::string, std::string > _extraValues
Definition authdata.h:78
zypp::media::AuthData::setUrl
void setUrl(const Url &url)
Definition authdata.h:51
zypp::media::AuthData::AuthData
AuthData()
Definition authdata.h:33
zypp::media::AuthData::_username
std::string _username
Definition authdata.h:75
zypp::media::AuthData::username
std::string username() const
Definition authdata.h:56
zypp::media::AuthData::_password
std::string _password
Definition authdata.h:76
std
Definition Arch.h:364
str
String related utilities and Regular expression matching.
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp::media::operator<<
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
Definition MediaHandler.cc:1181
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::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition Capability.cc:580
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
Url.h
PtrTypes.h