libzypp: zypp-curl/auth/curlauthdata.h Source File

libzypp 17.38.6

curlauthdata.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_CURL_AUTH_CURLAUTHDATA_H_INCLUDED
13#define ZYPP_CURL_AUTH_CURLAUTHDATA_H_INCLUDED
14
15#include <zypp-media/auth/AuthData>
16
17namespace zypp {
18 namespace media {
22 class ZYPP_API CurlAuthData : public AuthData {
23 public:
28 CurlAuthData();
29
30 CurlAuthData(const AuthData & authData);
31
32 CurlAuthData(std::string & username, std::string & password, std::string & auth_type)
33 : AuthData(username,password), _auth_type_str(auth_type)
34 {
35 _auth_type = auth_type_str2long(auth_type);
36 }
37
38 CurlAuthData(std::string & username, std::string & password, long auth_type)
39 : AuthData(username,password), _auth_type(auth_type)
40 {
41 _auth_type_str = auth_type_long2str(auth_type);
42 }
43
49 bool valid() const override;
50
55 void setAuthType(std::string auth_type)
56 {
57 _auth_type_str = auth_type; _auth_type = auth_type_str2long(auth_type);
58 }
59
65 void setAuthType(long auth_type)
66 {
67 _auth_type = auth_type;
68 _auth_type_str = auth_type_long2str(auth_type);
69 }
70
71 long authType() const { return _auth_type; }
72 std::string authTypeAsString() const { return _auth_type_str; }
73
74 std::string getUserPwd() const { return username() + ":" + password(); }
75
76
86 static long auth_type_str2long( std::string & auth_type_str );
87 static long auth_type_str2long( const std::string &auth_type_str );
88
93 static std::string auth_type_long2str(long auth_type);
94
95 std::ostream & dumpOn( std::ostream & str ) const override;
96
97 private:
98 std::string _auth_type_str;
99 long _auth_type;
100 };
101
102 using CurlAuthData_Ptr = shared_ptr<CurlAuthData>;
103 std::ostream & operator << (std::ostream & str, const CurlAuthData & auth_data);
104 }
105}
106
107#endif
shared_ptr
zypp::media::AuthData::password
std::string password() const
Definition authdata.h:57
zypp::media::AuthData::AuthData
AuthData()
Definition authdata.h:33
zypp::media::AuthData::username
std::string username() const
Definition authdata.h:56
zypp::media::CurlAuthData
Curl HTTP authentication data.
Definition curlauthdata.h:22
zypp::media::CurlAuthData::authTypeAsString
std::string authTypeAsString() const
Definition curlauthdata.h:72
zypp::media::CurlAuthData::CurlAuthData
CurlAuthData(std::string &username, std::string &password, long auth_type)
Definition curlauthdata.h:38
zypp::media::CurlAuthData::authType
long authType() const
Definition curlauthdata.h:71
zypp::media::CurlAuthData::auth_type_long2str
static std::string auth_type_long2str(long auth_type)
Converts a long of ORed CURLAUTH_* identifiers into a string of comma separated list of authenticatio...
Definition curlauthdata.cc:104
zypp::media::CurlAuthData::setAuthType
void setAuthType(long auth_type)
Set HTTP authentication type(s) to use.
Definition curlauthdata.h:65
zypp::media::CurlAuthData::CurlAuthData
CurlAuthData(std::string &username, std::string &password, std::string &auth_type)
Definition curlauthdata.h:32
zypp::media::CurlAuthData::_auth_type_str
std::string _auth_type_str
Definition curlauthdata.h:98
zypp::media::CurlAuthData::auth_type_str2long
static long auth_type_str2long(std::string &auth_type_str)
Converts a string of comma separated list of authetication type names into a long of ORed CURLAUTH_* ...
Definition curlauthdata.cc:50
zypp::media::CurlAuthData::_auth_type
long _auth_type
Definition curlauthdata.h:99
zypp::media::CurlAuthData::CurlAuthData
CurlAuthData()
Default constructor.
Definition curlauthdata.cc:26
zypp::media::CurlAuthData::setAuthType
void setAuthType(std::string auth_type)
Set HTTP authentication type(s) to use.
Definition curlauthdata.h:55
zypp::media::CurlAuthData::getUserPwd
std::string getUserPwd() const
Definition curlauthdata.h:74
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::CurlAuthData_Ptr
shared_ptr< CurlAuthData > CurlAuthData_Ptr
Definition curlauthdata.h:102
zypp::media::dumpOn
std::ostream & dumpOn(std::ostream &str, const TransferSettings &obj)
relates: TransferSettings
Definition transfersettings.cc:337
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