libzypp
17.35.1
urlcredentialextractor_p.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
13
#ifndef ZYPP_ZYPP_DETAIL_URLCREDENTIALEXTRACTOR_P_H
14
#define ZYPP_ZYPP_DETAIL_URLCREDENTIALEXTRACTOR_P_H
15
16
#include <
zypp-core/Url.h
>
17
#include <
zypp/media/CredentialManager.h
>
18
19
namespace
zypp
20
{
42
class
UrlCredentialExtractor
43
{
44
public
:
45
UrlCredentialExtractor
(
const
Pathname
&
root_r
)
46
:
_root
(
root_r
)
47
{}
48
49
UrlCredentialExtractor
(
Pathname
&
root_r
)
50
:
_root
(
root_r
)
51
{}
52
53
~UrlCredentialExtractor
()
54
{
if
(
_cmPtr
)
_cmPtr
->save(); }
55
57
bool
collect
(
const
Url
&
url_r
)
58
{
59
bool
ret
=
url_r
.hasCredentialsInAuthority();
60
if
(
ret
)
61
{
62
if
( !
_cmPtr
)
_cmPtr
.
reset
(
new
media::CredentialManager
(
_root
) );
63
_cmPtr
->addUserCred(
url_r
);
64
}
65
return
ret
;
66
}
68
template
<
class
TContainer>
69
bool
collect
(
const
TContainer &
urls_r
)
70
{
bool
ret
=
false
;
for
(
const
Url
& url :
urls_r
) {
if
(
collect
( url ) && !
ret
)
ret
=
true
; }
return
ret
; }
71
73
bool
extract
(
Url
&
url_r
)
74
{
75
bool
ret
=
collect
(
url_r
);
76
if
(
ret
)
77
url_r
.setPassword( std::string() );
78
return
ret
;
79
}
81
template
<
class
TContainer>
82
bool
extract
( TContainer &
urls_r
)
83
{
bool
ret
=
false
;
for
(
Url
& url :
urls_r
) {
if
(
extract
( url ) && !
ret
)
ret
=
true
; }
return
ret
; }
84
85
private
:
86
const
Pathname
&
_root
;
87
scoped_ptr<media::CredentialManager>
_cmPtr
;
88
};
89
}
90
91
#endif
CredentialManager.h
zypp::AutoDispose
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition
AutoDispose.h:95
zypp::AutoDispose::reset
void reset()
Reset to default Ctor values.
Definition
AutoDispose.h:150
zypp::UrlCredentialExtractor
Extract credentials in Url authority and store them via CredentialManager.
Definition
urlcredentialextractor_p.h:43
zypp::UrlCredentialExtractor::extract
bool extract(Url &url_r)
Remember credentials stored in URL authority stripping the passowrd from url_r.
Definition
urlcredentialextractor_p.h:73
zypp::UrlCredentialExtractor::~UrlCredentialExtractor
~UrlCredentialExtractor()
Definition
urlcredentialextractor_p.h:53
zypp::UrlCredentialExtractor::extract
bool extract(TContainer &urls_r)
Definition
urlcredentialextractor_p.h:82
zypp::UrlCredentialExtractor::collect
bool collect(const TContainer &urls_r)
Definition
urlcredentialextractor_p.h:69
zypp::UrlCredentialExtractor::collect
bool collect(const Url &url_r)
Remember credentials stored in URL authority leaving the password in url_r.
Definition
urlcredentialextractor_p.h:57
zypp::UrlCredentialExtractor::_root
const Pathname & _root
Definition
urlcredentialextractor_p.h:86
zypp::UrlCredentialExtractor::_cmPtr
scoped_ptr< media::CredentialManager > _cmPtr
Definition
urlcredentialextractor_p.h:87
zypp::UrlCredentialExtractor::UrlCredentialExtractor
UrlCredentialExtractor(Pathname &root_r)
Definition
urlcredentialextractor_p.h:49
zypp::UrlCredentialExtractor::UrlCredentialExtractor
UrlCredentialExtractor(const Pathname &root_r)
Definition
urlcredentialextractor_p.h:45
zypp::Url
Url manipulation class.
Definition
Url.h:92
zypp::filesystem::Pathname
Pathname.
Definition
Pathname.h:47
zypp::media::CredentialManager
Definition
credentialmanager.h:63
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition
Application.cc:20
Url.h
zypp
zypp_detail
urlcredentialextractor_p.h
Generated by
1.10.0