Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_session.rb « ci « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 27c71e305910517087646270193d7c856c193516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Ci
  class UserSession
    include ActiveModel::Conversion
    include Ci::StaticModel
    extend ActiveModel::Naming

    def authenticate(auth_opts)
      network = Ci::Network.new
      user = network.authenticate(auth_opts)

      if user
        user["access_token"] = auth_opts[:access_token]
        return Ci::User.new(user)
      else
        nil
      end

      user
    rescue
      nil
    end
  end
end