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.