Class: Rails::Vault::JWT::TokenProvider::RoleID
- Inherits:
-
BaseProvider
- Object
- BaseProvider
- Rails::Vault::JWT::TokenProvider::RoleID
- Defined in:
- lib/rails/vault/jwt/token_provider/role_id.rb
Instance Attribute Summary
Attributes inherited from BaseProvider
Instance Method Summary collapse
- #auth ⇒ Object
-
#initialize(*args, mount_name: 'approle', role_id: nil, secret_id: nil, token_ttl: '5m') ⇒ RoleID
constructor
A new instance of RoleID.
Methods inherited from BaseProvider
#bearer_token, #client, #token, #token_expired?, #token_life_remaining, #token_valid?
Constructor Details
#initialize(*args, mount_name: 'approle', role_id: nil, secret_id: nil, token_ttl: '5m') ⇒ RoleID
Returns a new instance of RoleID.
8 9 10 11 12 13 14 |
# File 'lib/rails/vault/jwt/token_provider/role_id.rb', line 8 def initialize(*args, mount_name: 'approle', role_id: nil, secret_id: nil, token_ttl: '5m') super @mount_name = mount_name @role_id = role_id || ENV.fetch('VAULT_ROLE_ID') @secret_id = secret_id || ENV.fetch('VAULT_SECRET_ID') @token_ttl = token_ttl end |
Instance Method Details
#auth ⇒ Object
16 17 18 19 |
# File 'lib/rails/vault/jwt/token_provider/role_id.rb', line 16 def auth client.logical.write("auth/#{@mount_name}/login", role_id: @role_id, secret_id: @secret_id, ttl: @token_ttl)&.auth end |