From 58f5eb11b9d349b59aa8998ae89d6bd56c23f517 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sun, 28 Feb 2021 02:04:07 +0100 Subject: [PATCH] Cruft of old Debian SSO code --- app/controllers/application_controller.rb | 35 ----------------------- 1 file changed, 35 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 56f44a4..3f081eb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -18,41 +18,6 @@ class ApplicationController < ActionController::Base end end - # If the visitor presents a valid SSL client certificate from Debian SSO - # then the frontend web server will send a certain request header. - # Log the user in and welcome them. - def debian_sso - # Only run if the user is not yet logged in - if not user_signed_in? - if debian_sso_dn = request.env['HTTP_X_DEBIAN_SSO_DN'] - - # Turn - # "/O=Debian SSO client certificate/CN=haas@debian.org" - # into - # haas@debian.org - debian_email = debian_sso_dn.split('/').grep(/^CN/).first.split('=').last - - raise "No valid certificate CN found" unless debian_email.include? '@' - - @user = User.where(provider: 'debian-sso', email: debian_email).first_or_create do |user| - user.provider = 'debian-sso' - user.email = debian_email - user.name = debian_email - # Set a random password - user.password = Devise.friendly_token[0,20] - end - - if @user.persisted? - flash[:notice] = 'You are logged in through the Debian SSO' - sign_in_and_redirect @user, :event => :authentication - else - redirect_to root_path, alert: @user.errors.full_messages.join("\n") - end - - end - end - end - # If the current user is an administrator then show a second bar below # the navigation bar that contains a paginator of packages that contain # screenshots that require moderation.