Class: Fog::AWS::Federation::Real

Inherits:
Object
  • Object
show all
Includes:
CredentialFetcher::ConnectionMethods
Defined in:
lib/fog/aws/federation.rb,
lib/fog/aws/requests/federation/get_signin_token.rb

Instance Method Summary collapse

Methods included from CredentialFetcher::ConnectionMethods

#refresh_credentials_if_expired

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



36
37
38
39
40
41
42
43
44
# File 'lib/fog/aws/federation.rb', line 36

def initialize(options={})
  @instrumentor       = options[:instrumentor]
  @instrumentor_name  = options[:instrumentor_name]  || 'fog.aws.federation'
  @connection_options = options[:connection_options] || {}
  @host               = 'signin.aws.amazon.com'
  @path               = '/federation'
  @scheme             = 'https'
  @connection         = Excon.new("#{@scheme}://#{@host}#{@path}")
end

Instance Method Details

#get_signin_token(session) ⇒ Object



5
6
7
8
# File 'lib/fog/aws/requests/federation/get_signin_token.rb', line 5

def (session)

  request('getSigninToken', CGI.escape(Fog::JSON.encode(session)))
end

#request(action, session) ⇒ Object



46
47
48
49
50
51
52
# File 'lib/fog/aws/federation.rb', line 46

def request(action, session)
  response = @connection.get(
    :query   => "Action=#{action}&SessionType=json&Session=#{session}",
    :expects => 200
  ).body
  Fog::JSON.decode(response)
end