Class: ForemanOpentofu::Token
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ForemanOpentofu::Token
- Defined in:
- app/models/foreman_opentofu/token.rb
Instance Method Summary collapse
Instance Method Details
#expired? ⇒ Boolean
5 6 7 |
# File 'app/models/foreman_opentofu/token.rb', line 5 def expired? !expire.respond_to?(:<=) || (expire <= Time.current) end |
#generate ⇒ Object
9 10 11 12 13 14 |
# File 'app/models/foreman_opentofu/token.rb', line 9 def generate self.expire = Time.current + Setting[:tfstate_token_timeout] self.token = SecureRandom.alphanumeric(255) save! token end |