summaryrefslogtreecommitdiff
path: root/lib/gitlab/o_auth/callback_handler.rb
blob: f248e6bb3ca6e2716c28c80a1307cde1e992f9fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Gitlab
  module OAuth
    class CallbackHandler < OmniauthCallbackHandlerBase
      def link_provider!
        current_user.identities
                    .with_extern_uid(oauth['provider'], oauth['uid'])
                    .first_or_create(extern_uid: oauth['uid'])
        log_audit_event(current_user, with: oauth['provider'])
        notify_authentication_updated!
      end

      protected

      def linked_user_class
        Gitlab::OAuth::User
      end
    end
  end
end