lib/puavo_authentication/controllers/helpers.rb in puavo_authentication-0.0.11 vs lib/puavo_authentication/controllers/helpers.rb in puavo_authentication-0.0.13

- old
+ new

@@ -25,10 +25,14 @@ when !current_user && Mime::JSON logger.debug "Using HTTP basic authentication" password = "" user = authenticate_with_http_basic do |login, password| - User.authenticate(login, password) + if login.match(/^service\//) + ExternalService.authenticate(login.match(/^service\/(.*)/)[1], password) + else + User.authenticate(login, password) + end end logger.debug "Basic Auth User: " + user.inspect if user session[:dn] = user.dn session[:password_plaintext] = password