2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-12-24 10:12:23 +01:00
|
|
|
class FranceConnectParticulierClient < OpenIDConnect::Client
|
2018-01-11 11:07:25 +01:00
|
|
|
def initialize(code = nil)
|
2024-04-17 15:33:37 +02:00
|
|
|
config = FRANCE_CONNECT[:particulier].deep_dup
|
2024-03-05 16:32:18 +01:00
|
|
|
|
|
|
|
# TODO: remove this block when migration to new domain is done
|
2024-04-17 11:36:35 +02:00
|
|
|
# dirty hack to redirect to the right domain
|
2024-04-17 15:33:37 +02:00
|
|
|
if !Rails.env.test? && Current.host != ENV.fetch("APP_HOST")
|
|
|
|
config[:redirect_uri] = config[:redirect_uri].gsub(ENV.fetch("APP_HOST"), Current.host)
|
|
|
|
end
|
2024-03-05 16:32:18 +01:00
|
|
|
|
|
|
|
super(config)
|
2018-01-11 11:07:25 +01:00
|
|
|
|
|
|
|
if code.present?
|
|
|
|
self.authorization_code = code
|
|
|
|
end
|
2015-12-24 10:12:23 +01:00
|
|
|
end
|
|
|
|
end
|