demarches-normaliennes/app/models/france_connect_particulier_client.rb

18 lines
521 B
Ruby
Raw Normal View History

class FranceConnectParticulierClient < OpenIDConnect::Client
def initialize(code = nil)
2024-04-17 15:33:37 +02:00
config = FRANCE_CONNECT[:particulier].deep_dup
# 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
super(config)
if code.present?
self.authorization_code = code
end
end
end