Package netscape.ldap.beans
Class LDAPSimpleAuth
java.lang.Object
netscape.ldap.beans.LDAPBasePropertySupport
netscape.ldap.beans.LDAPSimpleAuth
- All Implemented Interfaces:
Serializable
Invisible Bean that just authenticates a user with a Directory
Server and returns Y or N. It takes a host and port, and then either
a full distinguished name and password, an RDN and directory base, or
a cn value and directory base.
Optionally, a client can register as a PropertyChangeListener and will be notified when an authentication completes.
The Bean can be used from JavaScript, as in the following example where the parameters are taken from HTML text fields in an HTML form called "input":
Optionally, a client can register as a PropertyChangeListener and will be notified when an authentication completes.
The Bean can be used from JavaScript, as in the following example where the parameters are taken from HTML text fields in an HTML form called "input":
function checkAuthentication() { auth = new Packages.netscape.ldap.beans.LDAPSimpleAuth(); auth.setHost( document.input.host.value ); auth.setPort( parseInt(document.input.port.value) ); auth.setAuthDN( document.input.username.value ); auth.setAuthPassword( document.input.password.value ); result = auth.authenticate(); alert( "The response is: " + result ); }
- See Also:
-
Field Summary
Fields inherited from class netscape.ldap.beans.LDAPBasePropertySupport
AMBIGUOUS_RESULTS, AUTHENTICATION_ERROR, CONNECT_ERROR, INVALID_PARAMETER, NO_SUCH_OBJECT, OK, PROPERTY_NOT_FOUND
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no parametersLDAPSimpleAuth
(String theHost, int thePort) Constructor with host and port initializersLDAPSimpleAuth
(String theHost, int thePort, String dn, String password) Constructor with all required authentication parameters -
Method Summary
Modifier and TypeMethodDescriptionConnect to LDAP server using parameters specified in constructor and/or by setting properties and attempt to authenticate.void
authenticate
(String dn, String password) Connect to LDAP server using parameters specified in constructor and/or by setting properties and attempt to authenticate.static void
The main body if we run it as stand-alone application.Methods inherited from class netscape.ldap.beans.LDAPBasePropertySupport
addPropertyChangeListener, connect, convertToString, firePropertyChange, getAuthDN, getAuthPassword, getBase, getDebug, getErrorCode, getFilter, getHost, getPort, getScope, getUserID, getUserName, printDebug, removePropertyChangeListener, setAuthDN, setAuthPassword, setBase, setDebug, setDefaultReferralCredentials, setErrorCode, setFilter, setHost, setPort, setScope, setUserID, setUserName
-
Constructor Details
-
LDAPSimpleAuth
public LDAPSimpleAuth()Constructor with no parameters -
LDAPSimpleAuth
Constructor with host and port initializers- Parameters:
theHost
- host stringthePort
- port number
-
LDAPSimpleAuth
Constructor with all required authentication parameters- Parameters:
theHost
- host stringthePort
- port numberdn
- fully qualified distinguished name to authenticatepassword
- password for authenticating the dn
-
-
Method Details
-
authenticate
Connect to LDAP server using parameters specified in constructor and/or by setting properties and attempt to authenticate.- Returns:
- "Y" on successful authentication, "N" otherwise
-
authenticate
Connect to LDAP server using parameters specified in constructor and/or by setting properties and attempt to authenticate.- Parameters:
dn
- fully qualified distinguished name to authenticatepassword
- password for authenticating the dn- Returns:
- "Y" on successful authentication, "N" otherwise
-
authenticate
-
main
The main body if we run it as stand-alone application.- Parameters:
args
- list of arguments
-