Class: Hotsock::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/hotsock/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aws_access_key_idObject

Returns the value of attribute aws_access_key_id.



12
13
14
# File 'lib/hotsock/config.rb', line 12

def aws_access_key_id
  @aws_access_key_id
end

#aws_assume_role_arnObject

Returns the value of attribute aws_assume_role_arn.



14
15
16
# File 'lib/hotsock/config.rb', line 14

def aws_assume_role_arn
  @aws_assume_role_arn
end

#aws_assume_role_external_idObject

Returns the value of attribute aws_assume_role_external_id.



16
17
18
# File 'lib/hotsock/config.rb', line 16

def aws_assume_role_external_id
  @aws_assume_role_external_id
end

#aws_assume_role_session_nameObject

Returns the value of attribute aws_assume_role_session_name.



15
16
17
# File 'lib/hotsock/config.rb', line 15

def aws_assume_role_session_name
  @aws_assume_role_session_name
end

#aws_regionObject



7
8
9
# File 'lib/hotsock/config.rb', line 7

def aws_region
  @aws_region or raise ArgumentError, "Hotsock configuration requires an aws_region"
end

#aws_secret_access_keyObject

Returns the value of attribute aws_secret_access_key.



13
14
15
# File 'lib/hotsock/config.rb', line 13

def aws_secret_access_key
  @aws_secret_access_key
end

#issuer_aud_claimObject

Returns the value of attribute issuer_aud_claim.



18
19
20
# File 'lib/hotsock/config.rb', line 18

def issuer_aud_claim
  @issuer_aud_claim
end

#issuer_iat_claimObject

Returns the value of attribute issuer_iat_claim.



19
20
21
# File 'lib/hotsock/config.rb', line 19

def issuer_iat_claim
  @issuer_iat_claim
end

#issuer_iss_claimObject

Returns the value of attribute issuer_iss_claim.



20
21
22
# File 'lib/hotsock/config.rb', line 20

def issuer_iss_claim
  @issuer_iss_claim
end

#issuer_jti_claimObject

Returns the value of attribute issuer_jti_claim.



21
22
23
# File 'lib/hotsock/config.rb', line 21

def issuer_jti_claim
  @issuer_jti_claim
end

#issuer_key_algorithmObject



30
31
32
# File 'lib/hotsock/config.rb', line 30

def issuer_key_algorithm
  @issuer_key_algorithm || "ES256"
end

#issuer_key_idObject

Returns the value of attribute issuer_key_id.



23
24
25
# File 'lib/hotsock/config.rb', line 23

def issuer_key_id
  @issuer_key_id
end

#issuer_private_keyObject



25
26
27
# File 'lib/hotsock/config.rb', line 25

def issuer_private_key
  @issuer_private_key or raise ArgumentError, "Hotsock configuration requires issuer_private_key for JWT issuing"
end

#issuer_token_ttlObject

Returns the value of attribute issuer_token_ttl.



22
23
24
# File 'lib/hotsock/config.rb', line 22

def issuer_token_ttl
  @issuer_token_ttl
end

#publish_function_arnObject

Returns the value of attribute publish_function_arn.



17
18
19
# File 'lib/hotsock/config.rb', line 17

def publish_function_arn
  @publish_function_arn
end

Instance Method Details

#issuer_keyObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/hotsock/config.rb', line 35

def issuer_key
  case issuer_key_algorithm
  when "HS256", "HS384", "HS512"
    @issuer_key ||= issuer_private_key
  when "RS256", "RS384", "RS512"
    @issuer_key ||= OpenSSL::PKey::RSA.new(issuer_private_key)
  when "ES256", "ES384", "ES512"
    @issuer_key ||= OpenSSL::PKey::EC.new(issuer_private_key)
  else
    raise ArgumentError, "Issuer key algorithm must be one of HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512"
  end
end