Class: Mysql2::AwsRdsIam::AuthToken::ExpirableToken
- Inherits:
-
Object
- Object
- Mysql2::AwsRdsIam::AuthToken::ExpirableToken
- Defined in:
- lib/mysql2/aws_rds_iam/auth_token/expirable_token.rb
Constant Summary collapse
- DEFAULT_EXPIRE_AT =
By default token is valid for up to 15 minutes, here we expire it after 14 minutes
(15 * 60)
- EXPIRATION_THRESHOLD =
1 minute
(1 * 60)
- EXPIRE_HEADER =
'x-amz-expires'
Instance Method Summary collapse
-
#initialize(token) ⇒ ExpirableToken
constructor
A new instance of ExpirableToken.
- #value ⇒ Object
Constructor Details
#initialize(token) ⇒ ExpirableToken
Returns a new instance of ExpirableToken.
12 13 14 15 16 |
# File 'lib/mysql2/aws_rds_iam/auth_token/expirable_token.rb', line 12 def initialize(token) @token = token @created_at = now @expire_at = parse_expiration || DEFAULT_EXPIRE_AT end |
Instance Method Details
#value ⇒ Object
18 19 20 |
# File 'lib/mysql2/aws_rds_iam/auth_token/expirable_token.rb', line 18 def value token unless expired? end |