/**
* 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: MSISDN.java,v 1.3 2008/06/25 05:41:58 qcheng Exp $
*
*/
/*
* Portions Copyrighted 2013 ForgeRock, Inc.
*/
/**
* MSISDN Authentication module retrieves the device's <code>msisdn</code>
* number and the Wireless gateway sending the request from the
* <code>ServletRequest</code>. If the values cannot be retrieved then
* callbacks to get <code>msisdn</code> number and wap gateway are sent back to
* the client. The WAP Gateway is validated against a list of valid gateways in
* the gateway list attribute. If the gateway list attribute is empty then all
* gateways will trusted , if it is "none" then no gateways will be trusted and
* if specific values are specified only those gateways will be trusted. Once
* the gateway is validated the <code>msisdn</code> number is searched for in
* the repository. This module is written to lookup the <code>msisdn</code>
* number in LDAP and return the user ID which has the <code>msisdn</code>
* number.
*/
private int serverPort;
private boolean validGateway=false;
private boolean searchAllHeaders=false;
static {
}
public MSISDN() {
}
/**
* Retrieves the service schema attributes for the module
* and initializes the configuration, including locale and getting
* the resource bundle.
*
* @param subject Subject to be authenticated.
* @param sharedState State shared with other configured
* <code>LoginModules</code>.
* @param options Options specified in the login Configuration for this
* particular <code>LoginModule</code>.
*/
locale = getLoginLocale();
if (debug.messageEnabled()) {
}
}
/**
* Returns MSISDN auth config parameters.
*/
private void initAuthConfig() {
if (debug.messageEnabled()) {
}
errorMsgKey = "MSISDNInvalidGateway";
} else {
searchAllHeaders = true;
if (debug.messageEnabled()) {
}
}
}
} else {
errorMsgKey = "MSISDNValidateEx";
}
return;
}
/**
* Validates the authentication credentials.
*
* @param callbacks
* @param state
* @return ISAuthConstants.LOGIN_SUCCEED on login success
* @exception AuthLoginException
*/
throws AuthLoginException {
if (errorMsgKey != null) {
}
} else {
}
}
} else {
}
return ISAuthConstants.LOGIN_SUCCEED;
}
/**
* Returns the User Principal.
*
* @return MSISDN Principal.
*/
}
return userPrincipal;
}
/**
* Send callbacks to get gateway and msisdnNumber
*
* @return Map containing gateway and msisdnNumber
*/
try {
if (callbackHandler == null) {
throw new AuthLoginException(amAuthMSISDN,
"NoCallbackHandler",null);
}
// map to hold return
// process return
for (int i = 0; i < len; i ++) {
if (cb instanceof PasswordCallback) {
}
} else if (cb instanceof NameCallback) {
}
}
}
} catch (Exception e) {
if (debug.messageEnabled()) {
}
}
return map;
}
/** Sets the auth level */
private void setMSISDNAuthLevel() {
try {
} catch (Exception e) {
}
}
if (debug.messageEnabled()) {
}
}
/**
* check if gateway is trusted.
* true if list is empty OR does not contain "none" OR
* matches the one of the gateways in the list.
*/
}
/**
* Retreives the MSISDN number and WAP Gateway from
* HTTPServletRequest
*/
int index;
// search request headers for msisdn number
if (debug.messageEnabled()) {
}
// see if it's cookie
if (searchAllHeaders ||
if (cookieArray != null) {
if (cookieName != null &&
break; // break from for loop
}
}// end for
}
// if MSISDN number is found in cookies come out
if (msisdnNumber != null) {
break; // break from while loop
}
}// end inner if
if (searchAllHeaders ||
// check in headers.
}
if (msisdnNumber != null) {
break;
}
if (searchAllHeaders ||
}
if (msisdnNumber != null) {
break;
}
}
}
return msisdnNumber;
}
/**
* Cleans up module state.
*/
public void destroyModuleState() {
userTokenId = null;
}
/**
* TODO-JAVADOC
*/
public void nullifyUsedVars() {
errorMsgKey = null;
gatewayList = null;
serverHost = null;
}
}