Class: AWS::Core::SessionSigner

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/core/session_signer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ SessionSigner

Returns a new instance of SessionSigner.


32
33
34
35
# File 'lib/aws/core/session_signer.rb', line 32

def initialize config
  @config = config
  @session_mutex = Mutex.new
end

Class Method Details

.for(config) ⇒ Object


25
26
27
28
29
30
# File 'lib/aws/core/session_signer.rb', line 25

def self.for config
  @create_mutex.synchronize do
    @session_signers ||= {}
    @session_signers[config.signer.access_key_id] ||= self.new(config)
  end
end

Instance Method Details

#access_key_idObject


41
42
43
# File 'lib/aws/core/session_signer.rb', line 41

def access_key_id
  session.credentials[:access_key_id]
end

#refresh_sessionObject


53
54
55
56
57
58
# File 'lib/aws/core/session_signer.rb', line 53

def refresh_session
  sts = AWS::STS.new(:config => @config, :use_ssl => true)
  @session_mutex.synchronize do
    @session = sts.new_session
  end
end

#secret_access_keyObject


45
46
47
# File 'lib/aws/core/session_signer.rb', line 45

def secret_access_key
  session.credentials[:secret_access_key]
end

#session_tokenObject


49
50
51
# File 'lib/aws/core/session_signer.rb', line 49

def session_token
  session.credentials[:session_token]
end

#sign(*args) ⇒ Object


37
38
39
# File 'lib/aws/core/session_signer.rb', line 37

def sign *args
  short_term_signer.sign(*args)
end