summaryrefslogtreecommitdiff
path: root/app/models/clusters/agent_token.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/agent_token.rb')
-rw-r--r--app/models/clusters/agent_token.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/clusters/agent_token.rb b/app/models/clusters/agent_token.rb
new file mode 100644
index 00000000000..e9f1ee4e033
--- /dev/null
+++ b/app/models/clusters/agent_token.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Clusters
+ class AgentToken < ApplicationRecord
+ include TokenAuthenticatable
+ add_authentication_token_field :token, encrypted: :required
+
+ self.table_name = 'cluster_agent_tokens'
+
+ belongs_to :agent, class_name: 'Clusters::Agent'
+
+ before_save :ensure_token
+ end
+end