Cruft of old Debian SSO code
This commit is contained in:
parent
d19196b266
commit
58f5eb11b9
1 changed files with 0 additions and 35 deletions
|
|
@ -18,41 +18,6 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
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
|
# If the current user is an administrator then show a second bar below
|
||||||
# the navigation bar that contains a paginator of packages that contain
|
# the navigation bar that contains a paginator of packages that contain
|
||||||
# screenshots that require moderation.
|
# screenshots that require moderation.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue