Anonymous.java revision 2d0a88b18a041738cfe635b45bd1db56af469c91
/**
* 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: Anonymous.java,v 1.4 2009/06/17 21:53:19 ericow Exp $
*
*/
/*
* This module can be called in this way:
* <protocol>://<server host>:<server port>/<server deploy uri>
* OR &module=Anonymous
*/
public class Anonymous extends AMLoginModule {
private static final int DEFAULT_ANONYMOUS_AUTH_LEVEL = 0;
private Map sharedState;
private String userTokenId;
private String defaultAnonUser;
private Set validAnonUsernames;
private int authLevel;
// the authentication status
private boolean succeeded = false;
private boolean commitSucceeded = false;
// username and password
private AnonymousAuthPrincipal userPrincipal;
private CallbackHandler callbackHandler;
// whether to perform case sensitive authentication
private boolean isCaseSensitive = false;
boolean useSharedstate = false;
public Anonymous() {
}
}
this.sharedState = sharedState;
if (debug.messageEnabled()) {
}
try {
"iplanet-am-auth-anonymous-users-list");
if (validAnonUsernames == null) {
errorMsg = "AnonValidateEx";
}
"iplanet-am-auth-anonymous-default-user-name");
"iplanet-am-auth-anonymous-auth-level");
} else {
try {
} catch (Exception e) {
}
}
).booleanValue();
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
}
"Failed getting anonymous attributes for organization ");
errorMsg = "AnonValidateEx";
}
}
throws AuthLoginException {
}
try {
if (useSharedstate) {
if (processAnonUser(usernameParam)) {
return ISAuthConstants.LOGIN_SUCCEED;
}
}
if (debug.messageEnabled()) {
+ usernameParam);
}
if (processAnonUser(usernameParam)) {
return ISAuthConstants.LOGIN_SUCCEED;
}
}
}
} else {
}
if (debug.messageEnabled()) {
"Set auth level: " + authLevel +
"\nAnonymous userid: " + userTokenId);
}
} catch (Exception e) {
throw new AuthLoginException(
}
return ISAuthConstants.LOGIN_SUCCEED;
}
/**
* check if the userName is a valid anonymous user name
* in either case sensitive or insensitive cases.
*/
private boolean isValidAnonUserName() {
if (isCaseSensitive) {
} else {
return true;
}
}
}
return false;
}
if (userPrincipal != null) {
return userPrincipal;
} else if (userTokenId != null) {
return userPrincipal;
} else {
return null;
}
}
public void destroyModuleState() {
userTokenId = null;
}
public void nullifyUsedVars() {
sharedState = null;
}
if (callbackHandler == null) {
null);
}
try {
if (debug.messageEnabled()) {
}
return username;
} catch (IllegalArgumentException ill) {
throw new AuthLoginException(ioe);
} catch (UnsupportedCallbackException uce) {
null);
}
}
throws AuthLoginException {
if (useSharedstate) {
return false;
}
if (useSharedstate) {
return false;
}
null);
}
} else {
if (useSharedstate) {
return false;
}
null);
}
return true;
}
}