/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 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: FSIDPFinderService.java,v 1.4 2008/06/25 05:46:58 qcheng Exp $
*
*/
/**
* This class <code>FSIDPFinderService</code> is used to find a preferred
* identity provider by using a common domain cookie. If the common domain
* is not found, this will pick one from the random list of preferred
* identity providers from the list that it knows that it can proxy the
* authentication request.
*/
/**
* A static hash map that contains request IDs as keys and circle of
* trusts are as values. This static table will be used to iterate
* through the number of circle of trusts if the IDP is particapting
* in more than one circle of trust.
*/
/**
* Gets <code>IDP</code> from common domain and sends proxy authentication
* request to the <code>IDP</code>.
* @param request <code>HttpServletRequest</code> object
* @param response <code>HttpServletResponse</code> object
* @exception ServletException, IOException if error occurred.
*/
public void doGet(
) throws ServletException, IOException
{
return;
}
"either ProviderID or the RequestID");
throw new ServletException("invalidRequest");
}
try {
} catch (FSRedirectException fe) {
" has happened");
}
return;
}
try {
if (metaManager != null ) {
if (hostConfig != null) {
}
}
} catch (IDFFMetaException ie) {
"getting proxying hosted meta:", ie);
return;
}
// If the introduction cookie is not available or the provider
// is same as the local provider then do a local login.
" is null");
return;
}
} else {
"FSIDPFinderService.doGet:IDP to be proxied:" + idpID);
}
// Now proxy the authentication request to the preferred IDP.
try {
if (metaManager != null ) {
}
} catch (IDFFMetaException ie) {
"getting proxying hosted meta:", ie);
} catch (FSException fe) {
"sending the proxy authentication request.", fe);
}
}
}
/**
* Gets <code>IDP</code> from common domain and sends proxy authentication
* request to the <code>IDP</code>.
* @param request <code>HttpServletRequest</code> object
* @param response <code>HttpServletResponse</code> object
* @exception ServletException, IOException if error occurred.
*/
public void doPost(
) throws ServletException, IOException
{
}
/**
* Gets a preferred IDP from the common domain cookie.
* @param request HttpServletRequest
* @param response HttpServletResponse
* @param realm The realm under which the entity resides.
* @param entityID Hosted entity ID.
* @param requestID Original Authentication Request ID.
* @exception FSRedirectException for the redirection.
* IOException for any redirection failure.
*/
) throws FSRedirectException, IOException
{
"Preferred IDP found from the common domain." + idpID);
}
}
return idpID;
}
try {
if (metaManager != null) {
}
}
} catch (IDFFMetaException ie) {
"FSIDPFinderService.getCommonDomainIDP:cannot get meta:",
ie);
return null;
}
}
"FSIDPFinderService.getCommonDomainIDP::No more Cots.");
}
return null;
}
"FSIDPFinderService.getCommonDomainIDP: Trying Cot: " +
cotName);
}
try {
{
}
} catch (COTException fe) {
"Unable to retrieve reader service url.", fe);
}
if (readerServiceURL != null) {
"FSIDPFinderService.getCommonDomainIDP:Redirection URL:"
+ url);
}
"Redirection_Happened"));
}
}
return null;
}
{
if (authnRequest == null) {
"FSIDPFinderServer.getLoginURL: null authnrequest");
return null;
}
if (hostProviderID == null) {
"FSIDPFinderServer.getLoginURL: null hostProviderID");
return null;
}
try {
} catch (Exception e) {
"while retrieving meta config", e);
return null;
}
return formatLoginURL(
}
{
try {
return null;
}
//create return url
} else {
}
.append("&")
.append("&")
.append("&")
.append("&")
.append("&")
authnRequest.getRequestID()));
//create goto url
} else {
}
//create redirect url
} else {
}
}
}
return redirectUrl.toString();
} catch(Exception e){
"FSIDPFinderService.formatLoginURL: Exception: " ,e);
return null;
}
}
}