libzypp 17.32.5
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>
18
19namespace zypp
20{
43 {
44 public:
48
50 { if ( _cmPtr ) _cmPtr->save(); }
51
53 bool collect( const Url & url_r )
54 {
55 bool ret = url_r.hasCredentialsInAuthority();
56 if ( ret )
57 {
59 _cmPtr->addUserCred( url_r );
60 }
61 return ret;
62 }
64 template<class TContainer>
65 bool collect( const TContainer & urls_r )
66 { bool ret = false; for ( const Url & url : urls_r ) { if ( collect( url ) && !ret ) ret = true; } return ret; }
67
69 bool extract( Url & url_r )
70 {
71 bool ret = collect( url_r );
72 if ( ret )
73 url_r.setPassword( std::string() );
74 return ret;
75 }
77 template<class TContainer>
78 bool extract( TContainer & urls_r )
79 { bool ret = false; for ( Url & url : urls_r ) { if ( extract( url ) && !ret ) ret = true; } return ret; }
80
81 private:
82 const Pathname & _root;
84 };
85}
86
87#endif
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
void reset()
Reset to default Ctor values.
Extract credentials in Url authority and store them via CredentialManager.
bool extract(Url &url_r)
Remember credentials stored in URL authority stripping the passowrd from url_r.
bool collect(const TContainer &urls_r)
bool collect(const Url &url_r)
Remember credentials stored in URL authority leaving the password in url_r.
scoped_ptr< media::CredentialManager > _cmPtr
Url manipulation class.
Definition Url.h:92
Easy-to use interface to the ZYPP dependency resolver.