Class: RightScale::InfrastructureAuthClient
- Inherits:
-
AuthClient
- Object
- AuthClient
- RightScale::InfrastructureAuthClient
- Includes:
- InfrastructureHelpers
- Defined in:
- lib/right_infrastructure_agent/infrastructure_auth_client.rb
Overview
Authorization client for infrastructure agents
Instance Method Summary collapse
-
#auth_header ⇒ Hash
Headers to be added to HTTP request.
-
#headers ⇒ Hash
Headers to be added to HTTP request Include authorization header by default.
-
#initialize(client_name, router_url, config_dir, options = {}) ⇒ InfrastructureAuthClient
constructor
Initialized authorization client.
Methods included from InfrastructureHelpers
#constantize, #format_error, #render_nothing, #to_bool, #to_int_or_nil
Constructor Details
#initialize(client_name, router_url, config_dir, options = {}) ⇒ InfrastructureAuthClient
Initialized authorization client
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/right_infrastructure_agent/infrastructure_auth_client.rb', line 30 def initialize(client_name, router_url, config_dir, = {}) @client_name = client_name @router_url = router_url @agent_id = [:agent_id] config = GlobalSession::Configuration.new(File.join(config_dir, "global_session.yml"), ENV["RAILS_ENV"]) @global_session_dir = constantize(config["directory"]).new(config, File.join(config_dir, "authorities")) @global_session_timeout = (config["timeout"] * 8) / 10 @state = :authorized reset_stats end |
Instance Method Details
#auth_header ⇒ Hash
Headers to be added to HTTP request
61 62 63 64 |
# File 'lib/right_infrastructure_agent/infrastructure_auth_client.rb', line 61 def auth_header {"Authorization" => "Bearer #{infrastructure_session}"} end |
#headers ⇒ Hash
Headers to be added to HTTP request Include authorization header by default
50 51 52 53 |
# File 'lib/right_infrastructure_agent/infrastructure_auth_client.rb', line 50 def headers auth_header end |