/**
* 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: FSServiceManager.java,v 1.5 2008/06/25 05:46:56 qcheng Exp $
*
*/
/**
* Services use this class to obtain appropriate handlers for different
* profiles.
*/
public class FSServiceManager {
/**
* Private constructor.
*/
private FSServiceManager() {
}
/**
* profile.
* @param request http request object
* @param response http response object
* @param authnRequest authentication request object
* @param authnResponse authentication response object
* @param idpDescriptor identity provider descriptor who issued the
* authentication response
* @param idpEntityId identity provider's entity ID
* @return <code>FSAssertionArtifactHandler</code> object
*/
) {
"FSServiceManager.getAssertionArtifactHandler: Called");
(authnRequest == null) ||
(authnResponse == null))
{
return null;
}
} else {
"FSServiceManager.getAssertionArtifactHandler: "
+ "Unknown Protocol profile request");
return null;
}
} else {
+ "No protocol profile in the Request");
return null;
}
return returnHandler;
}
/**
* Obtains handler at <code>SP</code> side that will handle browser
* artifact profile.
* @param request http request object
* @param response http response object
* @param realm The realm under which the entity resides.
* @param idpSuccinctId identity provider's succinct ID
* @param samlRequest <code>SAML</code> request object
* @param relayState where to go after the process is done
* @return <code>FSAssertionArtifactHandler</code> object
*/
) {
"FSServiceManager.getBrowserArtifactHandler: Called");
(idpSuccinctId == null) ||
(samlRequest == null))
{
return null;
}
try {
"FSServiceManager.getBrowserArtifactHandler:" +
" IDP Id of the provider to communicate: " +
}
return new FSBrowserArtifactConsumerHandler(
"FSServiceManager.getBrowserArtifactHandler:Exception Occured:",
ex);
return null;
}
}
/**
* Returns handler at <code>IDP</code> side that handles single sign on and
* federation requests.
* @param request http request object
* @param response http response object
* @param authnRequest authentication request sent by service provider
* @param realm The realm under which the entity resides.
* @return <code>FSSSOAndFedHandler</code> object
*/
) {
return null;
}
try {
"FSServiceManager.getSSOAndFedHandler: requested profile:"
+ profile);
}
} else {
+ "Unknown Protocol profile request");
}
} else {
"FSServiceManager.getSSOAndFedHandler: "
+ "No protocol profile in the Request");
}
}
return returnHandler;
} catch(IDFFMetaException ex){
return null;
}
}
/**
* Returns handler for <code>IDP</code> to handle browser artifact profile.
* @param request http request object
* @param response http response object
* @param samlRequest <code>SAML</code> request
* @return <code>FSSSOAndFedHandler</code> object
*/
) {
" getBrowserArtifactSSOAndFedHandler: Called");
}
return null;
}
return new FSSSOBrowserArtifactProfileHandler(
}
/**
* Returns handler at <code>IDP</code> that handles <code>LECP</code>
* profile.
* @param request http request object
* @param response http response object
* @param authnRequest authentication request
* @param realm The realm under which the entity resides.
* @return <code>FSSSOLECPProfileHandler</code> object
*/
) {
try {
(authnRequest == null))
{
return null;
}
return new FSSSOLECPProfileHandler(
} catch(IDFFMetaException ex){
return null;
}
}
/*
* Returns name registration handler. This method is invoked by the
* <code>SP</code> at the end of account federation if name registration is
* turned on.
* The <code>remoteEntityId</code> passed is that of the <code>IdP</code>
* with whom registration will be done.
* @param realm the realm in which the provider resides
* @param remoteEntityId remote Provider Entity ID.
* @param remoteProviderRole remote Provider Role.
* @return <code>FSNameRegistrationHandler</code> the name registration
* handler
*/
{
new FSNameRegistrationHandler();
if (handlerRegistration != null) {
try {
if (metaManager == null) {
"getSPNameIdentifier failed to get meta " +
"Manager instance");
}
return null;
}
if (remoteProviderRole == null) {
return null;
} else if (remoteProviderRole.equalsIgnoreCase(
{
{
}
if (remoteDesc != null) {
return handlerRegistration;
} else {
return null;
}
} catch(IDFFMetaException e){
"to get remote descriptor:", e);
}
return null;
}
}
return handlerRegistration;
}
/*
* Returns <code>FSFedTerminationHandler</code>. This method is invoked at
* the end where the termination request is received. The handler is
* responsible for doing account defederation.
* @param terminationRequest federation termination request
* @param hostedConfig Hosted Provider's extended meta
* @param hostedEntityId hosted provider's entity ID
* @param hostedProviderRole hosted provider's role
* @param metaAlias hosted provider's meta alias
* @param remoteEntityId remote provider's entity ID
* @return <code>FSFedTerminationHandler</code> object
*/
) {
try {
"Entered FSServicemanager::getFedTerminationHandler");
if (managerInst == null) {
"Error in retrieving account manager");
return null;
}
// Get amId
}
if (nameQualifier != null &&
{
}
// for SP, search local, then remote IDP,
// for IDP, search remote SP, then local
acctkey = new FSAccountFedInfoKey(
} else {
}
acctkey = new FSAccountFedInfoKey(
} else {
acctkey = new FSAccountFedInfoKey(
}
}
return null;
}
}
}
remoteEntityId + " does not exist");
}
return null;
}
// Pass USERID TO HANDLER to AVOID SEARCH AGAIN
new FSFedTerminationHandler();
if (handlerTermination != null){
return handlerTermination;
} else {
return null;
}
} catch(Exception e){
"failed to get termination handler");
}
return null;
}
/*
* Returns <code>FSPreLogouHandler</code>. This method is invoked when a
* logout request is to be processed.
* @return FSPreLogoutHandler PreLogout handler
*/
"Entered FSServicemanager::getPreLogoutHandler");
try {
handlerLogout = new FSPreLogoutHandler();
if (handlerLogout != null) {
return handlerLogout;
}
}catch (Exception e){
"failed to get logout handler");
}
return null;
}
/*
* Returns federation termination handler. This method is invoked at the
* end where the termination is initiated. The handler is responsible
* for doing account defederation locally and then invoking termination at
* remote provider end.
* @param remoteEntityId provider with whom termination needs to be done
* @param remoteProviderRole role of remote provider
* @param userID user who is terminating federation with remote provider
* @param realm the realm under which the entity resides
* @param hostedEntityId hosted provider's entity id
* @param metaAlias hosted provider's meta alias
* @return <code>FSFedTerminationHandler</code> object
*/
) {
try {
" getFedTerminationHandler");
}
"Error in retrieving meta, account manager");
return null;
}
remoteEntityId + " does not exist");
}
return null;
}
// Pass USERDN TO HANDLER to AVOID SEARCH AGAIN
"Handler: remoteEntityID = " + remoteEntityId +
" remoteProviderRole = " + remoteProviderRole);
}
if(handlerTermination != null){
} else {
}
return handlerTermination;
} else {
return null;
}
} catch(Exception e){
"failed to get termination handler");
}
return null;
}
/*
* Returns <code>FSNameRegistrationHandler</code> instance. This method is
* invoked at the end where the registration is initiated. The handler
* is responsible for doing name registration at remote provider end and
* then locally.
* @param remoteEntityId provider with whom registration is to be done
* @param remoteProviderRole role of the remote provider
* @param userID user for whom registration will be done with remote
* provider
* @param hostEntityId hosted provider's entity ID
* @param metaAlias hosted provider's meta alias
* @return Name registration handler
*/
) {
try {
"Entered FSServiceManager::getNameRegistrationHandler");
"Error in retrieving meta, account manager");
return null;
}
remoteEntityId + " does not exist");
}
return null;
}
// Pass USERID TO HANDLER to AVOID SEARCH AGAIN
new FSNameRegistrationHandler();
if (handlerRegistration != null){
} else {
}
return handlerRegistration;
} else {
return null;
}
} catch(Exception e){
"failed to get registration handler");
}
return null;
}
/**
* Returns <code>FSServiceManager</code> instance.
* @return <code>FSServiceManager</code> instance
*/
synchronized(FSServiceManager.class) {
" Creating a new instance of ServiceManager");
}
instance = new FSServiceManager();
}
}
return instance;
}
}// end class