/*
* 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: Application.java,v 1.9 2009/07/23 18:54:17 qcheng Exp $
*
* Portions Copyrighted 2011-2015 ForgeRock AS.
*/
/**
* Application login module.<br>
* Use <code>IDToken0</code> to specify application name and
* <code>IDToken1</code> to specify secret.
* (Old usage : <code>Login.Token0</code> to specify application name and
* <code>Login.Token1</code> to specify secret.) For example:
* <pre>
* "module=Application&IDToken0=UrlAccessAgent&IDToken1=secret"
* </pre>
* OR
* <pre>
* "module=Application&IDToken0=<user id for Agent>&IDToken1=
* <password for Agent user>"
* </pre>
* Old usage:
* <pre>
* "module=Application&Login.Token0=UrlAccessAgent&Login.Token1=secret"
* </pre>
*/
private static boolean ldapSSL = false;
static {
new DecodeAction(tmp));
}
public Application() {
}
try {
if (debug.messageEnabled()) {
}
} catch (Exception e) {
if (debug.messageEnabled()) {
}
errorMsg = "appInitFalied";
}
}
}
/**
* Implementation of <code>AMLoginModule</code> abstract method.
* Refer to <code>AMLoginModule</code> for method syntax.
*/
throws AuthLoginException {
// check if there is any error during initialize
}
}
}
null);
}
}
}
) {
if (debug.messageEnabled()) {
"App.validate, secret matched for user : " + userName);
}
// backward compatible with the gateway for portal
}
else {
}
if (!isValidUserEntry(userDNString)) {
userDNString + " is not a valid special user entry");
"App validation failed, User not Valid: " + userName);
throw new AuthLoginException(
amAuthApplication, "userInvalid",
null);
}
} else {
}
null);
}
return ISAuthConstants.LOGIN_SUCCEED;
}
throws AuthLoginException {
boolean success = false;
if (debug.messageEnabled()){
}
if (debug.messageEnabled()){
+ "to DataStore Auth Module.");
}
if (userTokenId == null) {
}
success = true;
if (userTokenId == null) {
}
if (debug.messageEnabled()){
"Auth is successful,returning User = " + userTokenId);
}
success = true;
}
}
return success;
}
/**
* Returns Principal for the authenticated user.
*
* @return Principal for the authenticated user or null if
* authentication did not succeed.
*/
if (userPrincipal != null) {
return userPrincipal;
} else if (userTokenId != null) {
return userPrincipal;
} else {
return null;
}
}
/**
* to appname, key "secret" corresponds to secret
*/
try {
if (callbackHandler == null) {
throw new AuthLoginException(amAuthApplication,
"NoCallbackHandler", null);
}
if (debug.messageEnabled()) {
}
// map to hold return
// process return
for (int i = 0; i < len; i ++) {
if (cb instanceof PasswordCallback) {
}
} else if (cb instanceof NameCallback) {
}
}
}
return map;
} catch (Exception e) {
if (debug.messageEnabled()){
}
}
return null;
}
throws AuthLoginException {
if (debug.messageEnabled()){
}
try {
if (isSuperAdmin(userName)) {
ldapUtil = new LDAPAuthUtils(Collections.singleton(AuthD.directoryHostName + ":" + AuthD.directoryPort),
debug);
} else {
throw new AuthLoginException(amAuthApplication,
"InvalidUP", null);
}
} else {
} else {
throw new AuthLoginException(amAuthApplication,
"basicLDAPex", null);
}
}
} catch (LDAPUtilException ex) {
} else {
}
}
}
/**
* Authenticates to the datastore using idRepo API
*
* @param userName User Name
* @param userPassword User Password
* @return <code>true</code> if success. <code>false</code> if failure
* @throws <code> AuthLoginException </code>
*/
boolean retval = false;
"PasswordPrompt",false);
try {
getRequestOrg());
} catch (IdRepoException idrepoExp) {
if (debug.messageEnabled()){
+ "IdRepo Exception", idrepoExp);
}
}
return retval;
}
throws AuthLoginException {
try {
// All LDAP module Attribute Initialization done here ...
if (serverHost == null) {
return false;
}
"Fatal error: baseDN for search has invalid value");
null);
}
}
// set LDAP Parameters
int serverPort = 389;
if (index != -1) {
}
// set the optional attributes here
debug);
if (debug.messageEnabled()) {
"\nbaseDN-> " + baseDN +
"\nuserNamingAttr-> " + userNamingAttr+
"\nuserSearchAttr(s)-> " + userSearchAttrs+
"\nsearchFilter-> " + searchFilter +
"\nsearchScope-> " + searchScope +
"\nssl-> " + ssl+
"\nHost: "+serverHost+
"\nINDEDX : "+index+
"\nPORT : "+serverPort);
}
return true;
}
}
public void destroyModuleState() {
userTokenId = null;
}
public void nullifyUsedVars() {
}
}