Module: AWSUDO
- Defined in:
- lib/awsudo/identity_providers.rb,
lib/awsudo.rb,
lib/awsudo/identity_provider.rb,
lib/awsudo/identity_providers/adfs.rb,
lib/awsudo/identity_providers/okta.rb
Overview
Copyright © 2015-2017 Electronic Arts Inc. All rights reserved.
Defined Under Namespace
Modules: IdentityProviders Classes: IdentityProvider
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
- .ask_for_credentials ⇒ Object
- .assume_role_with_agent(role_arn, socket_name) ⇒ Object
- .load_config(filename) ⇒ Object
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/awsudo.rb', line 14 def logger @logger end |
Class Method Details
.ask_for_credentials ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/awsudo.rb', line 32 def self.ask_for_credentials fd = IO.sysopen("/dev/tty", "w") console = IO.new(fd,"w") console.print "Login: " username = STDIN.gets.chomp console.print "Password: " password = STDIN.noecho(&:gets).chomp console.print "\n" [username, password] end |
.assume_role_with_agent(role_arn, socket_name) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/awsudo.rb', line 17 def self.assume_role_with_agent(role_arn, socket_name) logger.debug {"role_arn: <#{role_arn}>"} logger.debug {"socket_name: <#{socket_name}>"} keys = UNIXSocket.open(socket_name) do |client| client.puts role_arn response = client.gets logger.debug {"response: <#{response}>"} raise "Connection closed by peer" if response.nil? JSON.parse(response.strip) end raise keys['error'] unless keys['error'].nil? keys end |
.load_config(filename) ⇒ Object
43 44 45 46 47 |
# File 'lib/awsudo.rb', line 43 def self.load_config(filename) config = Hash[*File.read(filename).scan(/^\s*(\w+)\s*=\s*(.*)\s*$/).flatten] logger.debug { "config: <#{config.inspect}>" } config end |