debian-mirror-gitlab/lib/gitlab/auth/atlassian/identity_linker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
751 B
Ruby
Raw Normal View History

2020-11-24 15:15:51 +05:30
# frozen_string_literal: true
module Gitlab
module Auth
module Atlassian
class IdentityLinker < OmniauthIdentityLinkerBase
extend ::Gitlab::Utils::Override
include ::Gitlab::Utils::StrongMemoize
private
override :identity
def identity
strong_memoize(:identity) do
current_user.atlassian_identity || build_atlassian_identity
end
end
def build_atlassian_identity
identity = current_user.build_atlassian_identity
::Gitlab::Auth::Atlassian::User.assign_identity_from_auth_hash!(identity, auth_hash)
end
def auth_hash
::Gitlab::Auth::Atlassian::AuthHash.new(oauth)
end
end
end
end
end