Class: MyPKI::Prompter::IRubyPrompter

Inherits:
Object
  • Object
show all
Defined in:
lib/mypki/prompters/iruby.rb

Instance Method Summary collapse

Instance Method Details

#file_prompt(prompt) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/mypki/prompters/iruby.rb', line 6

def file_prompt prompt

  if prompt['PKI']
    title = 'Configure MyPKI'
    prompt = 'Your script requires access to a PKI-enabled resource. Please select the PKI certificate you would like to use to access that resource.'
    label = :certificate

  elsif prompt['certificate']
    title = 'Missing Certificate'
    prompt = "You're missing a certificate. If you have a certificate to go with your key, upload it below. Press Cancel to start over."
    label = :certificate

   elsif prompt['private key']
    title = 'Missing Private Key'
    prompt = "You're missing a private key. If you have a private key to go with your certificate, upload it below. Press Cancel to start over."
    label = :private_key

  elsif prompt['CA']
    title = 'Add Trust Chains (Optional)'
    prompt = 'Please select the trust chain you would like to use to authenticate servers. Hit cancel if you do not want to verify servers.'
    label = :chains
    
  else
    abort "IRuby integration is missing a corresponding graphical prompt for '#{prompt}'"
  end

  iruby_file_prompt title, prompt, label
end

#pass_prompt(prompt) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/mypki/prompters/iruby.rb', line 35

def pass_prompt prompt
  response = IRuby.popup 'PKI Password' do 
    password
    cancel
    button
  end
  response[:password] if response
end