1 | <?php |
||
33 | class MacOsPasswordRetrievalStrategy implements PasswordRetrievalStrategyInterface |
||
34 | { |
||
35 | /** |
||
36 | * Constants used within this class |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | const KEYCHAIN_NAME = 'osxkeychain'; |
||
41 | const KEYCHAIN_SAVE = 'timely jira access'; |
||
42 | |||
43 | /** |
||
44 | * @var OutputInterface |
||
45 | */ |
||
46 | protected $output; |
||
47 | |||
48 | /** |
||
49 | * @var ConfigurationInterface |
||
50 | */ |
||
51 | protected $configuration; |
||
52 | |||
53 | /** |
||
54 | * MacOsPasswordRetrievalStrategy constructor. |
||
55 | * |
||
56 | * @param OutputInterface $output |
||
57 | * @param ConfigurationInterface $configuration |
||
58 | */ |
||
59 | public function __construct(OutputInterface $output, ConfigurationInterface $configuration) |
||
64 | |||
65 | /** |
||
66 | * Prompt silent |
||
67 | * |
||
68 | * Interactively prompts for input without echoing to the terminal. |
||
69 | * Requires a bash shell or Windows and won't work with |
||
70 | * safe_mode settings (Uses `shell_exec`) |
||
71 | * |
||
72 | * Source: http://www.sitepoint.com/interactive-cli-password-prompt-in-php/ |
||
73 | * |
||
74 | * @param OutputInterface $output Console output interface |
||
75 | * @param string $prompt The message to the user |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | protected function promptSilent(OutputInterface $output, $prompt = "Enter Password:") |
||
93 | |||
94 | /** |
||
95 | * Will retrieve a stored password from the OSX keychain |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | public function getPassword() |
||
112 | } |
||
113 |