summaryrefslogtreecommitdiff
path: root/app/models/atlassian/identity.rb
blob: 906f2be0fbf31fc38e60b2bf821dc3194727167a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

module Atlassian
  class Identity < ApplicationRecord
    self.table_name = 'atlassian_identities'

    belongs_to :user

    validates :extern_uid, presence: true, uniqueness: true
    validates :user, presence: true, uniqueness: true

    attr_encrypted :token,
                   mode: :per_attribute_iv,
                   key: Settings.attr_encrypted_db_key_base_truncated,
                   algorithm: 'aes-256-gcm',
                   encode: false,
                   encode_iv: false

    attr_encrypted :refresh_token,
                   mode: :per_attribute_iv,
                   key: Settings.attr_encrypted_db_key_base_truncated,
                   algorithm: 'aes-256-gcm',
                   encode: false,
                   encode_iv: false
  end
end