Class: AuthSource

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Redmine::Ciphering
Defined in:
app/models/auth_source.rb

Overview

redMine - project management software Copyright (C) 2006 Jean-Philippe Lang

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.

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.

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.

Direct Known Subclasses

AuthSourceLdap

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Redmine::Ciphering

cipher_key, decrypt_text, encrypt_text, included

Class Method Details

.allow_password_changes?Boolean

Does this auth source backend allow password changes?



50
51
52
# File 'app/models/auth_source.rb', line 50

def self.allow_password_changes?
  false
end

.authenticate(login, password) ⇒ Object

Try to authenticate a user not yet registered against available sources



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/models/auth_source.rb', line 55

def self.authenticate(, password)
  AuthSource.find(:all, :conditions => ["onthefly_register=?", true]).each do |source|
    begin
      logger.debug "Authenticating '#{}' against '#{source.name}'" if logger && logger.debug?
      attrs = source.authenticate(, password)
    rescue => e
      logger.error "Error during authentication: #{e.message}"
      attrs = nil
    end
    return attrs if attrs
  end
  return nil
end

Instance Method Details

#account_passwordObject



37
38
39
# File 'app/models/auth_source.rb', line 37

def 
  read_ciphered_attribute(:account_password)
end

#account_password=(arg) ⇒ Object



41
42
43
# File 'app/models/auth_source.rb', line 41

def (arg)
  write_ciphered_attribute(:account_password, arg)
end

#allow_password_changes?Boolean



45
46
47
# File 'app/models/auth_source.rb', line 45

def allow_password_changes?
  self.class.allow_password_changes?
end

#auth_method_nameObject



33
34
35
# File 'app/models/auth_source.rb', line 33

def auth_method_name
  "Abstract"
end

#authenticate(login, password) ⇒ Object



27
28
# File 'app/models/auth_source.rb', line 27

def authenticate(, password)
end

#test_connectionObject



30
31
# File 'app/models/auth_source.rb', line 30

def test_connection
end