/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: LocalLdapAuthModule.java,v 1.7 2009/01/28 05:34:52 ww203982 Exp $
*
* Portions Copyrighted 2011-2016 ForgeRock AS.
*/
/* Naming attribute for users */
private boolean readServerConfiguration = false;
public LocalLdapAuthModule() {
// do nothing
}
this.sharedState = sharedState;
}
// Check if we have username and password, else get it
if (debug.messageEnabled()) {
}
// Check if we have username and password, if not send callbacks
// Request for both username and password
try {
if (debug.messageEnabled()) {
+ "Name & Password Callback");
}
} catch (UnsupportedCallbackException e) {
throw (new LoginException(e.getMessage()));
} catch (IOException ioe) {
}
}
}
// Authenticate
boolean authentication = false;
authentication = true;
}
}
return (authentication);
}
return (true);
}
// Add the DN to the Subject
return (true);
}
return (true);
}
throws LoginException {
// LDAP connection used for authentication
int port;
// Check if organization is present in options
try {
// We need a handle on server instance so we can know the
// Connection type. If it is SSL, the connection needs to be
// accordingly created. Note: The user type does not make
// a difference, as the connection type is Server group based,
// so passing any user type for the second argument.
try {
} catch (GeneralSecurityException e) {
}
}
// The 389 port number passed is overridden by the
// hostName:port
// constructed by the getHostName method. So, this is not
// a hardcoded port number.
port = 389;
} else {
// Throw LoginException
}
} catch (LDAPServiceException ex) {
}
} else {
try {
if (debug.messageEnabled()) {
}
// Get hostname
int start;
boolean useSSL = false;
useSSL = true;
} else {
}
if (end == -1) {
if (end == -1)
}
// Get port number
if (end == -1)
}
if (useSSL) {
try {
} catch (GeneralSecurityException e) {
throw (new LoginException(e.getMessage()));
}
}
if (debug.messageEnabled()) {
+ ",port=" + portNumber);
}
} catch (Exception e) {
throw (new LoginException(e.getMessage()));
}
}
try (ConnectionFactory factory = LDAPUtils.createFailoverConnectionFactory(host, port, dn, passwd, ldapOptions);
return true;
} catch (LdapException e) {
throw new LoginException(e.getMessage());
}
}
.getString("com.iplanet.auth.invalid-username")));
}
return uid;
}
try {
// Use orgname only if it a DN, else baseDN
}
}
} catch (Exception e) {
// Ignore the exception and use the default naming attribute
}
.append(')');
try {
// Read the serverconfig.xml for LDAP information
if (!readServerConfiguration) {
}
"LocalLdapAuthModule.getDN(): lda connection is null");
throw (new LoginException("INVALID_USER_NAME"));
} else {
}
}
throw new LoginException("INVALID_USER_NAME");
}
return retVal;
} finally {
}
}
return;
try {
readServerConfiguration = true;
}
}
}