Methods added to including classes when LDAPAuthentication is mixed in.
The default attributes of a search
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
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
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
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
Generated with the Darkfish Rdoc Generator 2.