Sha256: 6f2b42e0f47e7639a95ad0d3b7ea3da5e62fd0cd5e5b5f56a589a7b12a32f8eb

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

require 'net/ldap'
require 'adauth/version'
require 'adauth/user'
require 'adauth/config'
require 'adauth/helpers'
require 'adauth/user_model' if defined? ActiveRecord

module Adauth
    def self.authenticate(login, pass)
        if @config.allowed_groups != []
            user = Adauth::User.authenticate(login, pass)
            (user && @config.allowed_groups != (@config.allowed_groups - user.groups)) ? user : nil
        elsif @config.denied_groups != []
            user = Adauth::User.authenticate(login, pass)
            (user && @config.denied_groups == (@config.denied_groups - user.groups)) ? user : nil
        else
            Adauth::User.authenticate(login, pass)
        end
    end
    
    def self.configure
       @config = Config.new
       yield(@config) 
    end
    
    def self.config
        @config
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adauth-1.0.0 lib/adauth.rb
adauth-1.0.0pre lib/adauth.rb