Class: Acs2aws::AcsServer
- Inherits:
-
Object
- Object
- Acs2aws::AcsServer
- Defined in:
- lib/acs2aws/acs_server.rb
Instance Attribute Summary collapse
-
#instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
-
#initialize ⇒ AcsServer
constructor
A new instance of AcsServer.
Constructor Details
#initialize ⇒ AcsServer
Returns a new instance of AcsServer.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/acs2aws/acs_server.rb', line 12 def initialize sp_url = File.read(Acs2aws::CONFIG_PATH) rescue nil valid_sp_url = URI.parse(sp_url).is_a?(URI::HTTP) rescue false raise StandardError.new('Error: '.colorize(:red) + 'Config not found or invalid. Please re-configure.') unless valid_sp_url @instance = Sinatra.new do set :port, Acs2aws::SERVER_PORT set :title, 'acs2aws' set :server, 'webrick' set :lock, true set :silent_all, true get '/' do puts "SAML Web Proxy Listening on http://localhost:#{Acs2aws::SERVER_PORT}" redirect "#{sp_url}?cli_port=#{Acs2aws::SERVER_PORT}" end post '/saml_acs' do Acs2aws::AwsSts.new(params['SAMLResponse']) body 'Successfully:) If this windows does not close automatically, please manually close this window. <script>window.opener = self;window.close();</script>' Thread.new do sleep 2 Process.kill 'TERM', Process.pid end halt 200 end end end |
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
10 11 12 |
# File 'lib/acs2aws/acs_server.rb', line 10 def instance @instance end |