##// END OF EJS Templates
Replaces find(:first) calls....
Replaces find(:first) calls. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10930 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9752:7a529b24ee40
r10703:a7023dfa9b8e
Show More
auth_source.rb
74 lines | 2.2 KiB | text/x-ruby | RubyLexer
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r9453 # Copyright (C) 2006-2012 Jean-Philippe Lang
Jean-Philippe Lang
0.3 unstable...
r10 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721 #
Jean-Philippe Lang
0.3 unstable...
r10 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721 #
Jean-Philippe Lang
0.3 unstable...
r10 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Jean-Philippe Lang
Friendly response when the LDAP connection fails....
r8791 # Generic exception for when the AuthSource can not be reached
# (eg. can not connect to the LDAP)
class AuthSourceException < Exception; end
Jean-Philippe Lang
Adds a configurable timeout for LDAP authentication (#8978)....
r9748 class AuthSourceTimeoutException < AuthSourceException; end
Jean-Philippe Lang
Friendly response when the LDAP connection fails....
r8791
Jean-Philippe Lang
0.3 unstable...
r10 class AuthSource < ActiveRecord::Base
Jean-Philippe Lang
Merged LdapAuthSourceController into AuthSourceController....
r9112 include Redmine::SubclassFactory
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 include Redmine::Ciphering
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721
Jean-Philippe Lang
0.3 unstable...
r10 has_many :users
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721
Jean-Philippe Lang
0.3 unstable...
r10 validates_presence_of :name
validates_uniqueness_of :name
Jean-Philippe Lang
Improved on-the-fly account creation. If some attributes are missing (eg. not present in the LDAP) or are invalid, the registration form is displayed so that the user is able to fill or fix these attributes....
r1661 validates_length_of :name, :maximum => 60
Jean-Philippe Lang
0.3 unstable...
r10
def authenticate(login, password)
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721
Jean-Philippe Lang
0.3 unstable...
r10 def test_connection
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721
Jean-Philippe Lang
0.3 unstable...
r10 def auth_method_name
"Abstract"
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 def account_password
read_ciphered_attribute(:account_password)
end
Toshi MARUYAMA
remove trailing white-spaces from app/models/auth_source.rb....
r6721
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 def account_password=(arg)
write_ciphered_attribute(:account_password, arg)
end
Jean-Philippe Lang
0.3 unstable...
r10
Eric Davis
Allow AuthSources to control if they allow password changes....
r3631 def allow_password_changes?
self.class.allow_password_changes?
end
# Does this auth source backend allow password changes?
def self.allow_password_changes?
false
end
Jean-Philippe Lang
0.3 unstable...
r10 # Try to authenticate a user not yet registered against available sources
def self.authenticate(login, password)
Jean-Philippe Lang
Code cleanup....
r9752 AuthSource.where(:onthefly_register => true).all.each do |source|
Jean-Philippe Lang
0.3 unstable...
r10 begin
logger.debug "Authenticating '#{login}' against '#{source.name}'" if logger && logger.debug?
attrs = source.authenticate(login, password)
Jean-Philippe Lang
Do not request blank LDAP attributes....
r2054 rescue => e
logger.error "Error during authentication: #{e.message}"
Jean-Philippe Lang
0.3 unstable...
r10 attrs = nil
end
return attrs if attrs
end
return nil
end
end