/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 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: MultiProtocolUtils.java,v 1.4 2009/03/20 21:06:32 weisun2 Exp $
*
*/
/**
* The <code>MultiProtocolUtils</code> class provides some utility methods.
*
*/
public class MultiProtocolUtils {
/** Creates a new instance of MultiProtocolUtils */
private MultiProtocolUtils() {
}
/**
* Returns base URL for the server, the URL contains the protocol, server
* name, server port and deployment URI. For example:
* @param request HttpServlet request object.
* @return URL string containing the server protocol, name, port and
* deployment uri.
*/
if (index != -1) {
}
}
/**
* Returns true if the relay state if one of the <code>URL</code> for
* the multi-federation protocol processing.
* @param relayState relay state to be checked.
* @return true if it is one of the multi-federation protocol processing
* <code>URL</code>.
*/
return false;
}
if (index == -1) {
return false;
}
}
/**
* Updates session property (<code>SingleLogoutManager.FEDERATION_PROTOCOLS
* </code>) with the new protocol information.
* @param session Session Object to be updated
* @param protocol Name of the Federation protocol to be added.
*/
}
try {
+ " current protocols=" + values);
}
} else {
}
}
}
} catch (UnsupportedOperationException ex) {
} catch (SessionException ex) {
}
}
/**
* Updates session property (<code>SingleLogoutManager.FEDERATION_PROTOCOLS
* </code>) with the new protocol information.
* @param session Session Object to be updated
* @param protocol Name of the Federation protocol to be added.
*/
}
try {
+ " current protocols=" + values);
}
return;
} else {
}
}
} catch (UnsupportedOperationException ex) {
} catch (SessionException ex) {
}
}
/**
* Returns true if the session is used in other federation protocols.
* @param request HttpServlet object
* @param protocol Protocol of the caller. Value is one of the following:
* <code>SingleLogoutManager.IDFF</code>
* <code>SingleLogoutManager.SAML2</code>
* <code>SingleLogoutManager.WS_FED</code>
* @return true if the session is used in other federation protocols,
* false otherwise.
*/
try {
} catch (SessionException ex) {
return false;
}
}
/**
* Returns true if the session is used in other federation protocols.
* @param session Session object
* @param protocol Protocol of the caller. Value is one of the following:
* <code>SingleLogoutManager.IDFF</code>
* <code>SingleLogoutManager.SAML2</code>
* <code>SingleLogoutManager.WS_FED</code>
* @return true if the session is used in other federation protocols,
* false otherwise.
*/
return false;
}
}
try {
"MultiProtocolUtils.isMPSession: protocols=" + vals[i]);
}
}
return false;
return true;
return false;
} else {
return true;
}
} catch (SessionException ex) {
} catch (UnsupportedOperationException ex) {
}
return false;
}
/**
* Returns true if the session is used in the specified federation protocol.
* @param request HttpServlet object
* @param protocol Protocol of the caller. Value is one of the following:
* <code>SingleLogoutManager.IDFF</code>
* <code>SingleLogoutManager.SAML2</code>
* <code>SingleLogoutManager.WS_FED</code>
* @return true if the session is used in this federation protocol,
* false otherwise.
*/
try {
} catch (SessionException ex) {
return false;
}
}
/**
* Returns true if the session is used in the specified federation protocol.
* @param session Session object
* @param protocol Protocol of the caller. Value is one of the following:
* <code>SingleLogoutManager.IDFF</code>
* <code>SingleLogoutManager.SAML2</code>
* <code>SingleLogoutManager.WS_FED</code>
* @return true if the session is used in this federation protocol,
* false otherwise.
*/
return false;
}
}
try {
"MultiProtocolUtils.usedInProtocol: protocols=" + vals);
}
return true;
}
}
}
return false;
} catch (SessionException ex) {
} catch (UnsupportedOperationException ex) {
}
return false;
}
/**
* Invalidates session for a specific protocol.
* This method invaldates the session if it is not used in any other
* federation protocol, otherwise modifies session property to remove
* the sepcified protocol from the session.
* @param session the session object to be invalidated.
* @param request HttpServletRequest object.
* @param response HttpServletResponse object.
* @param protocol the federaion protocol to be checked.
*/
} else {
}
}
/**
* Returns logout status in string form.
* @param status Single Logout Status. Possible values:
* <code>LOGOUT_SUCCEEDED_STATUS</code> - single logout succeeded.
* <code>LOGOUT_FAILED_STATUS</code> - single logout failed.
* <code>LOGOUT_PARTIAL_STATUS</code> - single logout partially
* succeeded.
* <code>LOGOUT_REDIRECTED_STATUS</code> - single logout request
* redirected.
* <code>LOGOUT_NO_ACTION_STATUS</code> - single loglout not
* performed.
* @return single logout status in string form. Possible values:
* <code>IFSConstants.LOGOUT_SUCCESS<code>,
* <code>IFSConstants.LOGOUT_FAILURE</code>
*/
switch (status) {
return IFSConstants.LOGOUT_FAILURE;
default:
return IFSConstants.LOGOUT_SUCCESS;
}
}
}