Sha256: 5b1c4c9e24994a10243a5c72fc1c4e73b25a5db8be4cb249eb068b8c76af8df3
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'net/ldap' require 'adauth/version' require 'adauth/user' require 'adauth/config' require 'adauth/helpers' require 'adauth/user_model' if defined? ActiveRecord # The top level module # # For Adauths documentation please see the github wiki. module Adauth # Takes a username and password as an input and returns an instance of `Adauth::User` # # Called as # Adauth.authenticate("Username", "Password") # # Will return `nil` if the username/password combo is wrong, if the username/password combo is correct it will return an instance of `Adauth::User` which can be used to populate your database. 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 # Used to configure Adauth # # Called as # Adauth.configure do |c| # c.foo = "bar" # end # # Configures Adauth and is required for Adauth to work. def self.configure @config = Config.new yield(@config) end # Returns the config object # # Allows access to the adauth config object so you can call the config values in your application def self.config @config end # Rails generators module Generators end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adauth-1.0.1 | lib/adauth.rb |