~ubuntu-branches/ubuntu/trusty/nordugrid-arc/trusty-proposed

« back to all changes in this revision

Viewing changes to src/hed/libs/credential/PasswordSource.h

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2013-11-29 13:39:10 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20131129133910-altaxrfowczzl2ev
Tags: 4.0.0-1
4.0.0 Release (Closes: #715131) (LP: #1049798)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __ARC_PASSWORD_SOURCE_H__
 
2
#define __ARC_PASSWORD_SOURCE_H__
 
3
 
 
4
#include <string>
 
5
 
 
6
namespace Arc {
 
7
 
 
8
class PasswordSource {
 
9
 public:
 
10
  typedef enum {
 
11
    NO_PASSWORD = 0, // No password is returned. Authoritative. Not same as empty password.
 
12
    PASSWORD = 1,     // Password is  provided. Authoritative.
 
13
    CANCEL = 2       // Request to cancel procedure which need password.
 
14
  } Result;
 
15
  virtual Result Get(std::string& password, int minsize, int maxsize) = 0;
 
16
};
 
17
 
 
18
class PasswordSourceNone: public PasswordSource {
 
19
 public:
 
20
  virtual Result Get(std::string& password, int minsize, int maxsize);
 
21
};
 
22
 
 
23
class PasswordSourceString: public PasswordSource {
 
24
 private:
 
25
  std::string password_;
 
26
 public:
 
27
  PasswordSourceString(const std::string& password);
 
28
  virtual Result Get(std::string& password, int minsize, int maxsize);
 
29
};
 
30
 
 
31
class PasswordSourceStream: public PasswordSource {
 
32
 private:
 
33
  std::istream* password_;
 
34
 public:
 
35
  PasswordSourceStream(std::istream* password);
 
36
  virtual Result Get(std::string& password, int minsize, int maxsize);
 
37
};
 
38
 
 
39
class PasswordSourceInteractive: public PasswordSource {
 
40
 private:
 
41
  std::string prompt_;
 
42
  bool verify_;
 
43
 public:
 
44
  PasswordSourceInteractive(const std::string& prompt, bool verify);
 
45
  virtual Result Get(std::string& password, int minsize, int maxsize);
 
46
};
 
47
 
 
48
} // namespace Arc
 
49
 
 
50
#endif // __ARC_PASSWORD_SOURCE_H__
 
51