Imported Upstream version 15.0.0
[platform/upstream/libzypp.git] / zypp / media / CredentialFileReader.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/media/CredentialFileReader.h
10  *
11  */
12 #ifndef ZYPP_MEDIA_CREDENTIALFILEREADER_H
13 #define ZYPP_MEDIA_CREDENTIALFILEREADER_H
14
15 #include "zypp/base/Function.h"
16 #include "zypp/Url.h"
17 #include "zypp/Pathname.h"
18
19 #include "zypp/media/MediaUserAuth.h"
20
21 ///////////////////////////////////////////////////////////////////
22 namespace zypp
23 { /////////////////////////////////////////////////////////////////
24   ///////////////////////////////////////////////////////////////////
25   namespace media
26   { /////////////////////////////////////////////////////////////////
27
28
29   //////////////////////////////////////////////////////////////////////
30   //
31   // CLASS NAME : CredentialFileReader 
32   //
33   class CredentialFileReader
34   {
35   public:
36     /**
37       * Callback definition.
38       * First parameter is the \ref Url with which the credentials are
39       * associated, the second are the credentials.
40       *
41       * Return false from the callback to get a \ref AbortRequestException
42       * to be thrown and the processing to be cancelled.
43       */
44     typedef function<bool(AuthData_Ptr &)> ProcessCredentials;
45
46     CredentialFileReader(const Pathname & crfile,
47                          const ProcessCredentials & callback);
48     ~CredentialFileReader();
49   private:
50     ProcessCredentials _callback;
51   };
52   //////////////////////////////////////////////////////////////////////
53
54
55     /////////////////////////////////////////////////////////////////
56   } // media
57   ///////////////////////////////////////////////////////////////////
58   /////////////////////////////////////////////////////////////////
59 } // zypp
60 ///////////////////////////////////////////////////////////////////
61
62 #endif /* ZYPP_MEDIA_CREDENTIALFILEREADER_H */