AuthXMLResponse.java revision 8af80418ba1ec431c8027fa9668e5678658d3611
/**
* 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: AuthXMLResponse.java,v 1.10 2008/12/03 01:00:44 veiming Exp $
*
*/
/*
* Portions Copyrighted [2011] [ForgeRock AS]
*/
/**
* AuthXMLResponse constructs the response XML string to return
* to the client.
*/
public class AuthXMLResponse {
int requestType ;
boolean isException = false;
boolean validSessionNoUpgrade = false;
/**
* Creates <code>AuthXMLResponse</code> object
* @param requestType id of request type
*/
public AuthXMLResponse(int requestType) {
this.requestType = requestType;
}
/**
* Sets the error code.
*
* @param errorCode Error Code.
*/
try {
if (debug.messageEnabled()) {
}
} catch (Exception e) {
}
}
/**
* Sets Error Message.
*
* @param msg Error Message.
*/
}
/**
* Sets Template.
*
* @param template Template.
*/
}
/**
* Sets the failure URL.
*
* @param failureURL Failure URL.
*/
this.failureURL = failureURL;
}
/**
* Sets the login status.
*
* @param loginStatus Login Status.
*/
this.loginStatus = loginStatus;
}
/**
* Sets the callbacks sent by module.
*
* @param reqdCallbacks Array of Request Callbacks.
*/
this.reqdCallbacks = reqdCallbacks;
}
/**
* Sets the remote request on the XML response
*
* @param remoteReq The Http Servlet Request to be set
*/
try {
} catch (IOException ioe) {
}
}
}
/**
* Sets the remote response on the XML response
*
* @param remoteRes The Http Servlet Response to be set
*/
try {
} catch (IOException ioe) {
}
}
}
/**
* Returns error XML string
*
* @return error XML string
*/
public String createXMLErrorString() {
if (authErrorMessage != null) {
}
}
}
if (authErrorTemplate != null) {
}
if (debug.messageEnabled()) {
}
return errorString;
}
/* create the login status xml string */
}
if (validSessionNoUpgrade) {
} else {
setSSOToken();
}
if (debug.messageEnabled()) {
}
}
if (validSessionNoUpgrade) {
} else {
}
}
if (validSessionNoUpgrade){
try {
} catch (SSOException ssoExp) {
+ ssoExp.getMessage());
}
} else {
}
if (successURL != null) {
}
if (validSessionNoUpgrade) {
} else {
}
if (debug.messageEnabled()) {
}
subject);
if (debug.messageEnabled()) {
"serialized Subject is : " + serializedSubject);
}
if (failureURL != null) {
}
} else {
}
if (debug.messageEnabled()) {
}
return statusXMLString;
}
/**
* Returns XML for the response based on the requested client information.
*
* @return XML for the response based on the requested client information.
*/
public String toXMLString() {
try{
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
}
switch (requestType) {
case AuthXMLRequest.NewAuthContext:
if (oldSession != null) {
}
} else {
}
break;
case AuthXMLRequest.Login:
case AuthXMLRequest.LoginIndex:
case AuthXMLRequest.LoginSubject:
if (validSessionNoUpgrade) {
+ "update. Returning success." );
break;
}
if (reqdCallbacks != null) {
} else {
) {
if (oldSession != null) {
.getSid());
.getID());
} else {
if (debug.messageEnabled()) {
+"destroying old session");
}
}
}
}
}
}
break;
if (isException) {
} else {
}
break;
case AuthXMLRequest.Logout:
case AuthXMLRequest.Abort:
if (isException) {
} else {
}
break;
}
} catch (Exception e) {
return null;
}
}
/**
* Sets the authentication context.
*
* @param authContext Authentication Context.
*/
this.authContext = authContext;
}
/**
* Sets if exception was thrown.
*
* @param isException <code>true</code> if exception was thrown.
*/
public void setIsException(boolean isException) {
this.isException = isException;
}
/**
* Sets the authentication identifier.
*
* @param authIdentifier Authentication identifier.
*/
this.authIdentifier = authIdentifier;
}
/**
* Sets the module names.
*
* @param moduleNames Module Names.
*/
this.moduleNames = moduleNames;
}
/**
* Returns XML for query information.
*
* @return XML for query information.
*/
public String getXMLForQueryInfo() {
if (!moduleNames.isEmpty()) {
}
}
if (debug.messageEnabled()) {
}
return queryResult;
}
/**
* Sets <code>SSOToken</code>
*/
public void setSSOToken() {
if (authContext != null) {
}
if (debug.messageEnabled()) {
}
}
/**
* Sets previous authentication context.
*
* @param aOldSession previous Internal Session
*/
this.oldSession = aOldSession;
}
/**
* Sets the attribute for valid session
* and no session upgrade in request.
*
* @param aValidSessionNoUpgrade Session is valid no upgrade needed
*/
public void setValidSessionNoUpgrade(boolean
}
this.authXMLReq = authXMLReq;
}
if (remoteRequest != null) {
}
if (remoteResponse != null) {
}
}
}
}