libzypp 17.31.23
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 CurlAuthData : public AuthData {
23 public:
29
30 CurlAuthData(const AuthData & authData);
31
32 CurlAuthData(std::string & username, std::string & password, std::string & auth_type)
34 {
35 _auth_type = auth_type_str2long(auth_type);
36 }
37
38 CurlAuthData(std::string & username, std::string & password, long auth_type)
40 {
42 }
43
49 virtual bool valid() const;
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;
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 virtual std::ostream & dumpOn( std::ostream & str ) const;
96
97 private:
98 std::string _auth_type_str;
100 };
101
102 typedef shared_ptr<CurlAuthData> CurlAuthData_Ptr;
103 std::ostream & operator << (std::ostream & str, const CurlAuthData & auth_data);
104 }
105}
106
107#endif
Class for handling media authentication data.
Definition: authdata.h:29
std::string password() const
Definition: authdata.h:55
std::string username() const
Definition: authdata.h:54
Curl HTTP authentication data.
Definition: curlauthdata.h:22
std::string authTypeAsString() const
Definition: curlauthdata.h:72
CurlAuthData(std::string &username, std::string &password, long auth_type)
Definition: curlauthdata.h:38
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...
void setAuthType(long auth_type)
Set HTTP authentication type(s) to use.
Definition: curlauthdata.h:65
CurlAuthData(std::string &username, std::string &password, std::string &auth_type)
Definition: curlauthdata.h:32
virtual std::ostream & dumpOn(std::ostream &str) const
Definition: curlauthdata.cc:43
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
CurlAuthData()
Default constructor.
Definition: curlauthdata.cc:26
void setAuthType(std::string auth_type)
Set HTTP authentication type(s) to use.
Definition: curlauthdata.h:55
std::string getUserPwd() const
Definition: curlauthdata.h:74
virtual bool valid() const
Checks validity of authentication data.
Definition: curlauthdata.cc:38
String related utilities and Regular expression matching.
std::ostream & operator<<(std::ostream &str, const MediaHandler &obj)
shared_ptr< CurlAuthData > CurlAuthData_Ptr
Definition: curlauthdata.h:102
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2