DRbService::LDAPAuthentication::ClassMethods

Methods added to including classes when LDAPAuthentication is mixed in.

Constants

DEFAULT_SEARCH

The default attributes of a search

Public Class Methods

extended( mod ) click to toggle source

Extension callback – add the necessary class instance variables to extended modules.

# File lib/drbservice/ldapauth.rb, line 23
def self::extended( mod )
        super
        mod.instance_variable_set( :@ldap_uri, nil )
        mod.instance_variable_set( :@ldap_dn, nil )
        mod.instance_variable_set( :@ldap_dn_search, DEFAULT_SEARCH.dup )
        mod.instance_variable_set( :@ldap_authz_callback, nil )
end

Public Instance Methods

ldap_authz_callback( callable=nil, &block ) click to toggle source

Register a function to call when the user successfully binds to the directory to check for authorization. It will be called with the Treequel::Branch of the bound user and the Treequel::Directory they are bound to. Returning true from this function will cause authorization to succeed, while returning a false value causes it to fail.

# File lib/drbservice/ldapauth.rb, line 66
def ldap_authz_callback( callable=nil, &block )
        if callable
                @ldap_authz_callback = callable
        elsif block
                @ldap_authz_callback = block
        end

        return @ldap_authz_callback
end
ldap_dn( pattern=nil ) click to toggle source

Set the pattern to use when creating the DN to use when binding.

# File lib/drbservice/ldapauth.rb, line 40
def ldap_dn( pattern=nil )
        @ldap_dn = pattern if pattern
        return @ldap_dn
end
ldap_dn_search( filter=nil, options={} ) click to toggle source

Set a filter that is used when searching for an account to bind as.

# File lib/drbservice/ldapauth.rb, line 48
def ldap_dn_search( filter=nil, options={} )
        if filter
                @ldap_dn_search ||= {}
                @ldap_dn_search[:filter] = filter
                @ldap_dn_search[:base] = options[:base] if options[:base]
                @ldap_dn_search[:scope] = options[:scope] if options[:scope]
        end

        return @ldap_dn_search
end
ldap_uri( uri=nil ) click to toggle source

Set the URI of the LDAP server to bind to for authentication

# File lib/drbservice/ldapauth.rb, line 33
def ldap_uri( uri=nil )
        @ldap_uri = uri if uri
        return @ldap_uri
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.