Merge pull request #10066 from demarches-simplifiees/temp_fix_for_france_connect
Tech: base la l'url de retour de FranceConnect sur le host de la requete
This commit is contained in:
commit
24fe51220f
3 changed files with 12 additions and 2 deletions
|
@ -28,6 +28,9 @@ class ApplicationController < ActionController::Base
|
||||||
Current.request_id = request.uuid
|
Current.request_id = request.uuid
|
||||||
Current.user = current_user
|
Current.user = current_user
|
||||||
Current.browser = browser
|
Current.browser = browser
|
||||||
|
# TODO: remove this block when migration to new domain is done
|
||||||
|
# headers['Host'] instead of request.host to keep the port (ex: localhost:3000)
|
||||||
|
Current.host = request.headers['Host']
|
||||||
end
|
end
|
||||||
|
|
||||||
def staging_authenticate
|
def staging_authenticate
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
class Current < ActiveSupport::CurrentAttributes
|
class Current < ActiveSupport::CurrentAttributes
|
||||||
attribute :user, :request_id, :browser
|
attribute :user, :request_id, :browser, :host
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
class FranceConnectParticulierClient < OpenIDConnect::Client
|
class FranceConnectParticulierClient < OpenIDConnect::Client
|
||||||
def initialize(code = nil)
|
def initialize(code = nil)
|
||||||
super(FRANCE_CONNECT[:particulier])
|
config = FRANCE_CONNECT[:particulier]
|
||||||
|
|
||||||
|
# TODO: remove this block when migration to new domain is done
|
||||||
|
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?
|
if code.present?
|
||||||
self.authorization_code = code
|
self.authorization_code = code
|
||||||
|
|
Loading…
Reference in a new issue