Commit 773c9180 authored by o's avatar o
Browse files

a temporary fix to support onion service login

parent 45887528
......@@ -91,6 +91,16 @@ class ApplicationController < ActionController::Base
end
helper_method :feature_toggle?
# TODO: this needs to be replaced with a real solution!
def fix_idp_url(url)
if request.host =~ /ysp4gfuhnmj6b4mb\.onion/
url.gsub(/immerda\.ch/, "ysp4gfuhnmj6b4mb.onion")
else
url
end
end
helper_method :fix_idp_url
def authorize
if !current_user
set_locale
......
......@@ -40,7 +40,7 @@ class SamlController < SessionsController
settings.issuer = "#{request.base_url}"
settings.assertion_consumer_service_url = "#{request.base_url}/saml/consume"
settings.idp_sso_target_url = SamlConfig.idp_sso
settings.idp_sso_target_url = fix_idp_url(SamlConfig.idp_sso)
settings.certificate = SamlConfig.cert
settings.private_key = SamlConfig.private_key
settings.name_identifier_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
......
......@@ -6,7 +6,7 @@ class SessionsController < ApplicationController
def destroy_local
reset_user_session
if SamlConfig.idp_sso_logout
redirect_to SamlConfig.idp_sso_logout
redirect_to fix_idp_url(SamlConfig.idp_sso_logout)
else
redirect_to '/login'
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment