Sha256: f47b6b46600ec8b921d2d02b250336e4264c4c1a1ca14300d7218ec6706c9559

Contents?: true

Size: 711 Bytes

Versions: 14

Compression:

Stored size: 711 Bytes

Contents

# Useful for Ruby interfacing
module AwsMfaSecure
  class Credentials < Base
    # Using Singleton as caching mechanism for speed
    # The fetch_creds? is slow from shelling out to python for aws configure get.
    include Singleton

    attr_reader :data
    def initialize
      @aws_profile = aws_profile
      setup
    end

    def setup
      return unless iam_mfa?

      if fetch_creds?
        resp = get_session_token(shell: true)
        save_creds(resp.credentials.to_h)
      end

      @data = credentials
    end

    def set?
      !!@data
    end

    %w[access_key_id secret_access_key session_token].each do |name|
      define_method name do
        @data[name]
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
aws-mfa-secure-0.4.2 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.4.1 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.4.0 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.8 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.7 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.6 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.5 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.4 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.3 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.2 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.1 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.3.0 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.2.0 lib/aws_mfa_secure/credentials.rb
aws-mfa-secure-0.1.0 lib/aws_mfa_secure/credentials.rb