2018-10-11 16:12:21 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-23 07:10:39 -05:00
|
|
|
# :nocov:
|
|
|
|
module Gitlab
|
|
|
|
module Auth
|
|
|
|
module OAuth
|
|
|
|
module Session
|
|
|
|
def self.create(provider, ticket)
|
|
|
|
Rails.cache.write("gitlab:#{provider}:#{ticket}", ticket, expires_in: Gitlab.config.omniauth.cas3.session_duration)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.destroy(provider, ticket)
|
|
|
|
Rails.cache.delete("gitlab:#{provider}:#{ticket}")
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.valid?(provider, ticket)
|
|
|
|
Rails.cache.read("gitlab:#{provider}:#{ticket}").present?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
# :nocov:
|