/*
* 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: MSISDNValidation.java,v 1.3 2008/06/25 05:41:59 qcheng Exp $
*
* Portions Copyrighted 2011-2015 ForgeRock AS.
*/
/**
* A class that searches LDAP for the user having
* attribute <code>sunIdentityMSISDNNumber</code> matching
* the authentication client's device <code>msisdn</code> number.
* LDAP user distinguished name is returned on a successful search.
*/
public class MSISDNValidation {
/**
* Holds handle to ResourceBundleCache to quickly get
* ResourceBundle for any Locale
*/
private boolean useSSL;
/**
* Creates <code>MSISNValidation</code> and set up the configuration to
* search LDAP for <code>msisdn</code> number.
*
* @param options configuration parameters to setup search in LDAP.
* @param debug for logging debug messages.
* @param bundle resource bundle for locale specific properties.
* @param locale login locale.
*/
protected MSISDNValidation(
) throws AuthLoginException {
}
/**
* Retrieves MSISDN auth config parameters.
* @param options , map contains MSISDN service attributes
* @exception throws AuthLoginException on error
*/
if (serverHost == null) {
errorMsgKey = "wrongLDAPServer";
} else {
// set LDAP Parameters
if (index != -1) {
}
if (startSearchLoc == null) {
"Fatal error: LDAP Start Search DN misconfigured");
errorMsgKey = "wrongStartDN";
}
}
if (debug.messageEnabled()) {
"\n\t serverPort = " + serverPort +
"\n\t startSearchLoc=" + startSearchLoc +
"\n\t userSearchAttr=" + userSearchAttr +
"\n\t principalUser=" + principalUser +
"\n\t serverHost =" + serverHost +
"\n\t userNamingAttr =" + userNamingAttr +
"\n\t returnUserDN =" + returnUserDN +
"\n\t useSSL=" + useSSL);
}
} else {
errorMsgKey = "MSISDNValidateEx";
}
if (errorMsgKey != null) {
}
}
/**
* Returns user ID which has <code>sunIdentityMSISDNNumber</code> matching
* the <code>msisdn<code> number.
*
* @param msisdnNumber to search.
* @throws AuthLoginException
*/
try {
debug);
case USER_FOUND:
return validatedUserID;
case USER_NOT_FOUND:
throw new AuthLoginException(amAuthMSISDN,
"userNotFound",null);
case SERVER_DOWN:
throw new AuthLoginException(amAuthMSISDN,
"MSISDNServerDown",null);
default:
throw new AuthLoginException(amAuthMSISDN,
"MSISDNValidateEx",null);
}
} catch (Exception e) {
throw new AuthLoginException(e);
}
}
}