libzypp: zypp-media/auth/authdata.h Source File

libzypp 17.38.6

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
20namespace zypp {
21 namespace media {
22
24
25
30 class ZYPP_API AuthData
31{
32public:
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
73private:
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
PtrTypes.h
Url.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 ansi.h:855
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::media::dumpOn
std::ostream & dumpOn(std::ostream &str, const TransferSettings &obj)
relates: TransferSettings
Definition transfersettings.cc:337
zypp::url
Url details namespace.
Definition UrlBase.cc:58
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173