/**
* 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: LibertyManager.java,v 1.7 2008/06/25 05:48:17 qcheng Exp $
*
*/
/**
* <code>LibertyManager</code> forms the basis of the Public APIs. It has all
* the methods which the JSPs etc. need to use for
* federation/termination/logout etc.
* @supported.all.api
*/
public class LibertyManager {
static {
}
/**
* Returns a list of all trusted Identity Providers under root realm.
*
* @return an iterator to a list of strings, each containing the
* entity ID of Identity Providers.
* @deprecated This method has been deprecated. Please use
* <code>getAllIDPList(String realm)</code> instead.
* @see #getAllIDPList(String)
*/
}
/**
* Returns a list of all trusted Identity Providers under the realm.
*
* @param realm The realm under which the entity resides.
* @return an iterator to a list of strings, each containing the
* entity ID of Identity Providers.
*/
// returns list of idps... for default org.
// since all the providers have their description under default org..
// hence returning the List of all the active idps.
try {
if (metaManager != null) {
// TODO: check if the idp is active if we decide to support it
}
} catch (IDFFMetaException ame) {
" Active ProviderIds ", ame);
}
}// end of method.
/**
* Returns a list of all trusted Identity Providers under root realm
* for a given hosted provider's entity ID.
*
* @param hostedEntityID hosted provider's entity ID.
* @return an iterator to a list of strings, each containing the provider
* ID of an trusted Identity Provider for this hosted provider.
* @deprecated This method is deprecated. Please use
* <code>getIDPList(String,String)</code>
* @see #getIDPList(String,String)
*/
}
/**
* Returns a list of all trusted Identity Providers under the realm
* for a given hosted provider's entity ID.
*
* @param realm The realm under which the entity resides.
* @param hostedEntityID hosted provider's entity ID.
* @return an iterator to a list of strings, each containing the provider
* ID of an trusted Identity Provider for this hosted provider.
*/
return getList(
}
/**
* Returns a list of all trusted Service Providers under root realm.
*
* @return an iterator to a list of strings, each containing the
* entity ID of a Service Provider.
* @deprecated This method is deprecated. Please use
* <code>getAllSPList(String realm)</code>.
* @see #getAllSPList(String)
*/
}
/**
* Returns a list of all trusted Service Providers under the realm.
*
* @param realm The realm under which the entity resides.
* @return an iterator to a list of strings, each containing the
* entity ID of a Service Provider.
*/
// returns list of sps... for default org.
// since all the providers have their description under default org..
// hence returning the List of all the active sps.
try {
if (metaManager != null) {
// TODO: check if the sp is active if we decide to support it
}
} catch (IDFFMetaException ame) {
" Active ProviderIds ", ame);
}
}
/**
* Returns a list of all trusted Service Providers under root realm for this
* Hosted Provider.
*
* @param hostedEntityID hosted provider's entity ID.
* @return an iterator to a list of strings, each containing the
* entity ID of an Service Provider for the given Hosted Provider.
* @deprecated This method is deprecated. Please use
* <code>getSPList(String,String)</code>
* @see #getSPList(String,String)
*/
}
/**
* Returns a list of all trusted Service Providers for this
* Hosted Provider.
*
* @param realm The realm under which the entity resides.
* @param hostedEntityID hosted provider's entity ID.
* @return an iterator to a list of strings, each containing the
* entity ID of an Service Provider for the given Hosted Provider.
*/
return getList(
}
/**
* Returns the federation status of a user with an Identity Provider.
* This method assumes that the user is already federated with the
* provider.
* @param user The user name obtained by calling <code>getUser()</code> on a
* Liberty-authenticated <code>HttpServletRequest</code> from the user
* @param remoteEntityId Entity ID of the Remote Identity Provider.
* @param hostedEntityId Hosted Provider's entity ID.
* @param hostedProviderRole Hosted Provider's Role.
* @return The federation status of a user with an Identity Provider.
* @deprecated This method is deprecated.
* @see #getIDPFederationStatus(String,String,String,String)
*/
public static boolean getIDPFederationStatus(
{
return getIDPFederationStatus(
}
/**
* Returns the federation status of a user with an Identity Provider.
* This method assumes that the user is already federated with the
* provider.
* @param user The user name obtained by calling <code>getUser()</code> on a
* Liberty-authenticated <code>HttpServletRequest</code> from the user
* @param realm The realm under which the entity resides.
* @param remoteEntityId Entity ID of the Remote Identity Provider.
* @param hostedEntityId Hosted Provider's entity ID.
* @param hostedProviderRole Hosted Provider's Role.
* @return The federation status of a user with an Identity Provider.
*/
public static boolean getIDPFederationStatus(
{
boolean result = false;
remoteEntityId == null ||
hostedEntityId == null ||
{
" parameters.");
return result;
}
try {
} catch (FSAccountMgmtException ame) {
"Couldnot get Federation Status ", ame);
}
return result;
}
/**
* Returns the federations status of a user with an Service Provider.
* This method assumes that the user is already federated with the
* provider.
*
* @param user The user name obtained by calling
* <code>getRemoteUser()</code> on a Liberty-authenticated
* <code>HttpServletRequest</code> from the user.
* @param remoteProviderId The entity ID of the Remote Service Provider.
* @param hostedProviderId Hosted provider's entity ID.
* @param hostedProviderRole Hosted Provider Role.
* @return The federation status of a user with an Service Provider.
* @deprecated This method is deprecated.
* @see #getSPFederationStatus(String,String,String,String,String)
*/
public static boolean getSPFederationStatus(
{
return getSPFederationStatus(
}
/**
* Returns the federations status of a user with an Service Provider.
* This method assumes that the user is already federated with the
* provider.
*
* @param user The user name obtained by calling
* <code>getRemoteUser()</code> on a Liberty-authenticated
* <code>HttpServletRequest</code> from the user.
* @param realm The relam under which the entity resides.
* @param remoteProviderId The entity ID of the Remote Service Provider.
* @param hostedProviderId Hosted provider's entity ID.
* @param hostedProviderRole Hosted Provider Role.
* @return The federation status of a user with an Service Provider.
*/
public static boolean getSPFederationStatus(
{
boolean result = false;
remoteProviderId == null ||
hostedProviderId == null ||
{
" null input parameters.");
return result;
}
try {
} catch (FSAccountMgmtException ame) {
"Couldnot get Federation Status ", ame);
}
return result;
}
/**
* Returns a nonce for use in forms to be posted to well known servlets.
* Avoids cross site scripting type attacks.
*
* @param user The user obtained by calling
* <code>getRemoteUser()</code> on a Liberty-authenticated
* <code>HttpServletRequest</code>from the user.
* @return A string to be put in a hidden form field called "nonce".
* @deprecated This method has been deprecated. Please use other
* means to generate nounce.
*/
return nonce;
}
/**
* Checks that the given nonce is the same as the last one returned via
* <code>getNonce()</code>, and invalidates it.
*
* @param nonce String containing nonce.
* @param user User name passed to <code>getNonce</code> to obtain nonce.
* @deprecated This method has been deprecated. Please use other
* means to verify nounce.
* @return true is <code>nonce</code> is the same as the last one
* returned by <code>getNonce</code> method.
*/
return true;
}
/**
* Returns the ID of the provider discovered via the introduction protocol.
* If <code>null</code>, no provider was discovered. Can be passed to
* <code>LoginServlet</code> if <code>null</code>.
*
* @param request HTTP servlet request.
* @return the provider ID
*/
return provider;
}
/**
* The steps for getting the <code>IDPList</code> and <code>SPList</code>
* are the same (except for a role check). So having this private method
* which takes in role and does the required function.
*/
{
if (providerConfig != null) {
}
if (trustedProviders == null) {
trustedProviders = new HashSet();
}
return trustedProviders.iterator();
}
// From here starts the methods which are outside the publicAPI but are
// used by the jsp(Logout/Termination/Federation/CommonLogin...)
/**
* Returns the <code>metaAliasKey</code> from <code>IFSConstants</code>.
*
* @return the <code>metaAliasKey</code> from <code>IFSConstants</code>.
*/
return IFSConstants.META_ALIAS;
}
/**
* Returns the termination <code>providerIDKey</code> from
* <code>IFSConstants</code>.
*
* @return the termination <code>providerIDKey</code> from
* <code>IFSConstants</code>.
*/
return IFSConstants.TERMINATION_PROVIDER_ID;
}
/**
* Returns the <code>requestIDKey</code> from <code>IFSConstants</code>.
*
* @return the <code>requestIDKey</code> from <code>IFSConstants</code>.
*/
return IFSConstants.AUTH_REQUEST_ID;
}
/**
* Returns the <code>providerIDKey</code> from <code>IFSConstants</code>.
*
* @return the <code>providerIDKey</code> from <code>IFSConstants</code>.
*/
return IFSConstants.PROVIDER_ID_KEY;
}
/**
* Returns the <code>LRURLKey</code> from <code>IFSConstants</code>.
*
* @return the <code>LRURLKey</code> from <code>IFSConstants</code>.
*/
return IFSConstants.LRURL;
}
/**
* Returns the <code>COT</code> key from <code>IFSConstants</code>.
*
* @return the <code>COT</code> key from <code>IFSConstants</code>.
*/
return IFSConstants.COTKEY;
}
/**
* Returns the <code>selectedProviderKey</code> from
* <code>IFSConstants</code>.
*
* @return the <code>selectedProviderKey</code> from
* <code>IFSConstants</code>.
*/
return IFSConstants.SELECTEDPROVIDER;
}
/**
* Returns Federation Error Key.
*
* @return Federation Error Key
*/
return IFSConstants.FEDERROR;
}
/**
* Returns <code>FederationRemark</code> Key.
*
* @return <code>FederationRemark</code> Key
*/
return IFSConstants.FEDREMARK;
}
/**
* Returns the user from <code>HttpServletRequest</code>.
*
* @param request HTTP servlet request.
* @return the user from <code>HttpServletRequest</code>.
*/
try {
}
return null;
} catch (SessionException ssoe) {
return null;
}
}
/**
* Returns Provider's <code>HomePageURL</code>.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @return Provider's <code>HomePageURL</code>.
* @deprecated This method is deprecated.
* @see #getHomeURL(String,String,String)
*/
}
/**
* Returns Provider's <code>HomePageURL</code>.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @return Provider's <code>HomePageURL</code>.
*/
{
}
return homeURL;
}
/**
* Returns <code>PreLoginServlet</code> URL and appends
* <code>metaAlias</code> to it.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return <code>PreLoginServlet</code> URL and appends
* <code>metaAlias</code> to it.
* @deprecated This method is deprecated.
* @see #getPreLoginServletURL(String,String,String,HttpServletRequest)
*/
{
return getPreLoginServletURL(
}
/**
* Returns <code>PreLoginServlet</code> URL and appends
* <code>metaAlias</code> to it.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return <code>PreLoginServlet</code> URL and appends
* <code>metaAlias</code> to it.
*/
{
}
/**
* Returns the <code>LoginURL</code> from <code>IFSConstants</code>.
*
* @param request HTTP servlet request.
* @return the <code>LoginURL</code> from <code>IFSConstants</code>
*/
if (debug.messageEnabled()) {
" returnURL = " + returnURL);
}
return returnURL;
}
/**
* Returns the <code>interSiteURL</code> from <code>IFSConstants</code>.
*
* @param request HTTP servlet request.
* @return the <code>interSiteURL</code> from <code>IFSConstants</code>.
*/
if (debug.messageEnabled()) {
+ "returnURL = " + returnURL);
}
return returnURL;
}
/**
* Returns <code>entityID</code> from the provider Alias
* using <code>meta manager</code> calls.
*
* @param metaAlias The <code>metaAlias</code> of the provider
* @return <code>entityID</code> corresponding to the
* <code>metaAlias</code>.
*/
try {
if (metaManager == null) {
return null;
}
} catch (IDFFMetaException ame) {
return null;
}
}
/**
* Returns the list of all Trusted Identity Providers of this user not
* already federated with. This is a subset of the Set returned by
* <code>getIDPList()</code>. This method is used to show the drop-down
* menu consisting of all the Identity Providers that the user is not
* already federated with.
*
* @param providerID provider's entity ID.
* @param providerRole provider Role.
* @param userName name of user.
* @return Set containing all the Identity Provider IDs which the user is
* not already federated with.
* @deprecated This method is deprecated. Please use
* <code>getProvidersToFederate(String, String, String,String)</code>
* @see #getProvidersToFederate(String,String,String,String)
*/
{
return getProvidersToFederate(
}
/**
* Returns the list of all Trusted Identity Providers of this user not
* already federated with. This is a subset of the Set returned by
* <code>getIDPList()</code>. This method is used to show the drop-down
* menu consisting of all the Identity Providers that the user is not
* already federated with.
*
* @param realm the realm that the provider resides
* @param providerID provider's entity ID.
* @param providerRole provider Role.
* @param userName name of user.
* @return Set containing all the Identity Provider IDs which the user is
* not already federated with.
*/
{
if (providerID == null ||
providerRole == null ||
{
" parameter values");
return unFederatedIDPs;
}
{
" ProviderRole.");
return unFederatedIDPs;
}
try {
}
}
} catch (FSAccountMgmtException ame) {
" getting allFederatedProviderID from Account Mgmt", ame);
}
return unFederatedIDPs;
}
/**
* Returns the set of federated providers for an user
* using Account Management API.
*
* @param userName for which the federated providers are to be returned.
* @param hostProviderId Hosted provider's entity ID.
* @param hostProviderRole Hosted Provider Role.
* @return federated providers a Set containing the provider IDs of
* federated providers for the given <code>userName</code>.
* @deprecated This method is deprecated.
* @see #getFederatedProviders(String, String, String, String)
*/
{
return getFederatedProviders(
}
/**
* Returns the set of federated providers for an user
* using Account Management API.
*
* @param userName for which the federated providers are to be returned.
* @param realm The realm under which the entity resides.
* @param hostProviderId Hosted provider's entity ID.
* @param hostProviderRole Hosted Provider Role.
* @return federated providers a Set containing the provider IDs of
* federated providers for the given <code>userName</code>.
*/
{
try {
} catch (FSAccountMgmtException ame) {
" getting federatedProviderIDs from Account Mgmt", ame);
}
return federatedProviders;
}
/**
* Returns the List of COTs for the given Provider under root realm.
*
* @param providerId The ID of the provider whose <code>COTList</code>
* is to be found
* @param providerRole The Role of the provider whose <code>COTList</code>
* is to be found
* @return The set containing the authentication domains for the given
* provider.
* @deprecated This method is deprecated.
* @see #getListOfCOTs(String,String,String)
*/
}
/**
* Returns the List of COTs for the given Provider under a realm.
*
* @param realm The realm under which the entity resides.
* @param providerId The ID of the provider whose <code>COTList</code>
* is to be found
* @param providerRole The Role of the provider whose <code>COTList</code>
* is to be found
* @return The set containing the authentication domains for the given
* provider.
*/
{
if (hostConfig != null) {
try {
new CircleOfTrustManager();
{
}
} catch (COTException fsExp) {
"COTException caught ", fsExp);
}
}
}
if (debug.messageEnabled()) {
" cot set with " + returnSet);
}
} else {
if (debug.messageEnabled()) {
" null. Looks like COT is not set");
}
}
}
return returnSet;
}
/**
* Returns <code>metaAlias</code> from provider ID under root realm.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @return <code>metaAlias</code> from provider ID
* @deprecated This method is deprecated by
* <code>getMetaAlias(String,String,String)</code>.
* @see #getMetaAlias(String,String,String)
*/
}
/**
* Returns <code>metaAlias</code> from provider ID under a realm.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @return <code>metaAlias</code> from provider ID
*/
{
if (providerConfig != null) {
}
if (debug.messageEnabled()) {
}
return metaAlias;
}
/**
* Returns the <code>FederationDonePageURL</code> from the provider ID
* under root realm.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the <code>FederationDonePageURL</code> from the provider ID.
* @deprecated This method is deprecated.
* @see #getFederationDonePageURL(String,String,String,HttpServletRequest)
*/
{
return getFederationDonePageURL(
}
/**
* Returns the <code>FederationDonePageURL</code> from the provider ID
* under a realm.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the <code>FederationDonePageURL</code> from the provider ID.
* @deprecated This method is deprecated.
* @see #getFederationDonePageURL(String,String,String,HttpServletRequest)
*/
{
if (providerConfig != null) {
}
}
/**
* Returns the <code>TerminationDonePageURL</code> from the provider ID
* under root realm.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the <code>TerminationDonePageURL</code> from the provider ID.
* @deprecated This method is deprecated
* @see #getTerminationDonePageURL(String,String,String,HttpServletRequest)
*/
{
return getTerminationDonePageURL(
}
/**
* Returns the <code>TerminationDonePageURL</code> from the provider ID
* under a realm.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the <code>TerminationDonePageURL</code> from the provider ID.
*/
{
if (providerConfig != null) {
}
}
/**
* Returns Termination URL.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return Termination URL.
* @deprecated This method is deprecated
* @see #getTerminationURL(String,String,String,HttpServletRequest)
*/
{
}
/**
* Returns Termination URL.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return Termination URL.
*/
{
}
/**
* Returns <code>NameRegistrationURL</code>.
*
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return <code>NameRegistrationURL</code>.
* @deprecated This method is deprecated.
* @see #getNameRegistrationURL(String,String,String,HttpServletRequest)
*/
{
return getNameRegistrationURL(
}
/**
* Returns <code>NameRegistrationURL</code>.
*
* @param realm The realm under which the entity resides.
* @param providerID Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return <code>NameRegistrationURL</code>.
*/
{
}
/**
* Returns the provider's error page.
*
* @param providerId Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the provider's error page.
* @deprecated This method is deprecated. Please use
* <code>getErrorPageURL(String,String,String,HttpServletRequest)</code>
* @see #getErrorPageURL(String,String,String,HttpServletRequest)
*/
{
}
/**
* Returns the provider's error page.
*
* @param realm The realm under which the entity resides.
* @param providerId Provider's entity ID.
* @param providerRole Provider Role.
* @param request HTTP servlet request.
* @return the provider's error page.
*/
{
if (providerConfig != null) {
}
return FSServiceUtils.getErrorPageURL(
}
/**
* Returns the <code>FederationHandler</code>.
*
* @param request HTTP servlet request
* @return the <code>FederationHandler</code>.
*/
if (debug.messageEnabled()) {
"LibertyManager: getFederationHandler: returnURL = " +
}
return returnURL;
}
/**
* Returns the <code>ConsentHandler</code>.
*
* @param request HTTP servlet request.
* @return the <code>ConsentHandler</code>.
*/
if (debug.messageEnabled()) {
"LibertyManager: getConsentHandler: returnURL = " + returnURL);
}
return returnURL;
}
/**
* Returns true if logout succeeded.
*
* @param request HTTP servlet request.
* @return true if logout succeeded.
*/
{
return true;
} else {
return false;
}
}
/**
* Returns true if Termination succeeds.
*
* @param request HTTP servlet request.
* @return true if Termination succeeds.
*/
{
return true;
} else {
return false;
}
}
/**
* Returns true if Federation is cancelled.
*
* @param request HTTP servlet request.
* @return true if Federation is cancelled.
*/
{
return true;
} else {
return false;
}
}
/**
* Returns true if termination is cancelled.
*
* @param request HTTP servlet request.
* @return true if termination is cancelled.
*/
{
return true;
} else {
return false;
}
}
/**
* Returns the realm by parsing the metaAlias. MetaAlias format is
* <pre>
* <realm>/<any string without '/'> for non-root realm or
* /<any string without '/'> for root realm.
* </pre>
* @param metaAlias The metaAlias.
* @return the realm associated with the metaAlias.
*/
}
/**
* Creates New Request ID from the <code>HttpRequestServlet</code>.
*
* @param request HTTP servlet request.
* @return New Request ID from the <code>HttpRequestServlet</code>.
*/
try {
if (metaManager != null) {
}
} catch (IDFFMetaException ame) {
" while getting the HostedProvider from meta mgmt",
ame);
}
if (debug.messageEnabled()) {
" no goto in queryString.Assinging targetURL = " +
homePage);
}
}
try {
// get the authlevel key
if (debug.messageEnabled()) {
"new request created with id " + reqID);
}
return reqID;
} else {
" Could not create new request ");
return null;
}
} catch (FSLoginHelperException exp) {
"In login helper exception ", exp);
return null;
}
}
/**
* Sets the authentication request to be sent to identity provider under
* root realm.
*
* @param request <code>FSAuthnRequest</code> associated with a user
* session.
* @param entityID Hosted Provider's entity ID
* @return <code>true</code> if the operation is successful;
* <code>false</code> otherwise.
* @deprecated This method is deprecated.
* @see #setAuthnRequest(FSAuthnRequest,String,String)
*/
public static boolean setAuthnRequest(
{
}
/**
* Sets the authentication request to be sent to identity provider.
*
* @param request <code>FSAuthnRequest</code> associated with a user
* session.
* @param realm the realm in which the entity resides
* @param entityID Hosted Provider's entity ID
* @return <code>true</code> if the operation is successful;
* <code>false</code> otherwise.
*/
public static boolean setAuthnRequest(
{
return false;
}
try {
return true;
}
" Exception while setting authn request.", ex);
}
return false;
}
/**
* Returns the HeaderMap.
*/
while (headerNames.hasMoreElements()) {
}
return headerMap;
}
while (paramEnum.hasMoreElements()) {
{
if (debug.messageEnabled()) {
" found metaAlias or LRURL or AUTH_REQUEST_ID.");
}
} else {
+ paramKey + "="
}
}
}
// check and append the authlevel key
} else {
}
}
if (debug.messageEnabled()) {
" returning with " + returnString);
}
return returnString;
}
/**
* Returns succinct ID of a provider.
*
* @param entityID provider's entity ID.
* @return succinct ID of a provider.
* @deprecated This method has been deprecated. Use
* {@link #getSuccinctID(String, String)}
*/
}
/**
* Returns succinct ID of a provider.
*
* @param providerID provider's entity ID.
* @param providerRole provider Role.
* @return succinct ID of a provider.
*/
}
/**
* Returns registered providers of an user.
*
* @param userName user ID.
* @param hostProviderId Hosted provider's entity ID.
* @param providerRole Hosted Provider Role.
* @return registered providers.
* @deprecated This method is deprecated. Please use
* <code>getRegisteredProviders(String,String,String,String)</code>
* @see #getRegisteredProviders(String,String,String,String)
*/
{
return getRegisteredProviders(
}
/**
* Returns registered providers of an user.
*
* @param userName user ID.
* @param realm The realm under which the entity resides.
* @param hostProviderId Hosted provider's entity ID.
* @param providerRole Hosted Provider Role.
* @return registered providers.
*/
{
try {
} catch (FSAccountMgmtException ame) {
" getting federatedProviderIDs from Account Mgmt", ame);
}
return registeredProviders;
}
/**
* Returns name registration provider ID key.
*
* @return name registration provider ID key.
*/
return IFSConstants.REGISTRATION_PROVIDER_ID;
}
/**
* Returns true if name registration is cancelled.
*
* @param request HTTP servlet request.
* @return true if name registration is cancelled.
*/
public static boolean isNameRegistrationCancelled(
{
return true;
} else {
return false;
}
}
/**
* Returns true if name registration succeeds.
*
* @param request HTTP servlet request.
* @return true if name registration succeeds.
*/
{
{
return true;
} else {
return false;
}
}
/**
* Returns the Name <code>RegistrationDonePageURL</code> from the
* <code>providerID</code> under root realm.
*
* @param providerID provider's entity ID.
* @param providerRole provider Role.
* @param request HTTP servlet request.
* @return the Name <code>RegistrationDonePageURL</code> from the
* <code>providerID</code>.
* @deprecated This method is deprecated. Please use
* <code>getNameRegistrationDonePageURL(
* String,String,String,HttpServletRequest)</code>
* @see #getNameRegistrationDonePageURL(String,String,String,HttpServletRequest)
*/
{
return getNameRegistrationDonePageURL(
}
/**
* Returns the Name <code>RegistrationDonePageURL</code> from the
* <code>providerID</code> under a realm.
*
* @param realm The realm under which the entity resides.
* @param providerID provider's entity ID.
* @param providerRole provider Role.
* @param request HTTP servlet request.
* @return the Name <code>RegistrationDonePageURL</code> from the
* <code>providerID</code>.
*/
{
if (extendedConfig != null) {
}
}
/**
* Returns Authentication Request Envelope from a HTTP servlet request.
* @param request a HTTP servlet request
* @return Authentication Request Envelope in String
*/
{
}
/**
* Determines if a HTTP servlet request is Liberty-enabled client and
* proxy profile.
* @param request a HTTP servlet request
* @return <code>true</code> if it is Liberty-enabled client and
* proxy profile
*/
}
/**
* Returns Liberty-enabled client and proxy profile HTTP header name.
* @return header name
*/
return IFSConstants.LECP_HEADER_NAME;
}
/**
* Returns Liberty-enabled client and proxy profile HTTP content type.
* @return content type
*/
return IFSConstants.LECP_CONTENT_TYPE_HEADER;
}
/**
* Returns the Discovery Service Resource Offerings nodes in an attribute
* statement. After a single sign-on with an Identity Provider, a service
* provider may get Discovery Service Resource Offerings through a SAML
* assertion. This APIs helps in retrieving the resource offerings
* if the user has been authenticated through the liberty SSO. It will
* need to have a valid single sign on token (generated through the
* liberty SSO).
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param providerID Hosted Provider's entity ID
* @return <code>NodeList</code> Discovery Resource Offering Nodes,
* <code>null</code> if there is any failure or if there is not one
* @deprecated This method has been deprecated. Use
* {@link #getDiscoveryBootStrapResourceOfferings(
* HttpServletRequest request, String providerID, String providerRole)}
*/
{
if (debug.messageEnabled()) {
"Offering: null Input params");
}
return null;
}
try {
"Offerings: Theres no liberty session for this token");
}
return null;
}
return session.getBootStrapResourceOfferings();
" Exception while retrieving discovery boot strap info.", ex);
return null;
}
}
/**
* Returns the Discovery Service Resource Offerings nodes in an attribute
* statement. After a single sign-on with an Identity Provider, a service
* provider may get Discovery Service Resource Offerings through a SAML
* assertion. This APIs helps in retrieving the resource offerings
* if the user has been authenticated through the liberty SSO. It will
* need to have a valid single sign on token (generated through the
* liberty SSO). The service provider should be under root realm.
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param providerID Hosted Provider's entity ID
* @param providerRole Hosted Provider Role
* @return <code>NodeList</code> Discovery Resource Offering Nodes,
* <code>null</code> if there is any failure or if there is not one
*/
{
if (debug.messageEnabled()) {
"Offering: null Input params");
}
return null;
}
try {
if (debug.messageEnabled()) {
"Offerings: Theres no liberty session for this token");
}
return null;
}
return session.getBootStrapResourceOfferings();
" Exception while retrieving discovery boot strap info.", ex);
return null;
}
}
/**
* Returns the Discovery Service Credentials in the Advice element.
* After a single sign-on with an Identity Provider, a service
* provider may get Discovery Service Resource Offerings and Credentials
* through a SAML assertion. This APIs helps in retrieving the Credentials
* if the user has been authenticated through the liberty SSO. It will
* need to have a valid single sign on token (generated through the
* liberty SSO). The service provider should be under root realm.
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param providerID Hosted Provider's entity ID
* @return <code>List</code> of <code>SecurityAssertions</code>,
* null if there is any failure or if there is not one
* @deprecated This method has been deprecated. Use
* {@link #getDiscoveryBootStrapCredentials(
* HttpServletRequest request, String providerID, String providerRole)}
*/
{
if (debug.messageEnabled()) {
" null Input params");
}
return null;
}
try {
if (debug.messageEnabled()) {
+ ": Theres no liberty session for this token");
}
return null;
}
return session.getBootStrapCredential();
" Exception while retrieving discovery boot strap info.", ex);
return null;
}
}
/**
* Returns the Discovery Service Credentials in the Advice element.
* After a single sign-on with an Identity Provider, a service
* provider may get Discovery Service Resource Offerings and Credentials
* through a SAML assertion. This APIs helps in retrieving the Credentials
* if the user has been authenticated through the liberty SSO. It will
* need to have a valid single sign on token (generated through the
* liberty SSO). The service provider should be under root realm.
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param providerID Hosted Provider's entity ID
* @param providerRole Hosted Provider Role
* @return <code>List</code> of <code>SecurityAssertions</code>,
* <code>null</code> if there is any failure or if there is not one
*/
{
if (debug.messageEnabled()) {
" null Input params");
}
return null;
}
try {
if (debug.messageEnabled()) {
+ ": Theres no liberty session for this token");
}
return null;
}
return session.getBootStrapCredential();
" Exception while retrieving discovery boot strap info.", ex);
return null;
}
}
/**
* Returns the authentication context used in liberty single sign-on.
* After single sign-on with an Identity Provider, a service
* provider may obtain the authentication context used by the identity
* provider that authenticates the user. It will need to have a valid
* single sign on token (generated through the liberty SSO). The providers
* are under root realm.
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param entityID Hosted Provider's entity ID
* @return authentication context string;
* <code>null</code> if there is any failure, or no liberty
* session is found.
* @deprecated This method is deprecated.
* @see #getAuthnContext(HttpServletRequest,String,String)
*/
{
}
/**
* Returns the authentication context used in liberty single sign-on.
* After single sign-on with an Identity Provider, a service
* provider may obtain the authentication context used by the identity
* provider that authenticates the user. It will need to have a valid
* single sign on token (generated through the liberty SSO).
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param realm the realm in which the provider resides
* @param entityID Hosted Provider's entity ID
* @return authentication context string;
* <code>null</code> if there is any failure, or no liberty
* session is found.
*/
{
return null;
}
try {
if (debug.messageEnabled()) {
+ ": There is no liberty session for this token");
}
return null;
}
return session.getAuthnContext();
" Exception while retrieving authncontext.", ex);
return null;
}
}
/**
* Returns the federation information associated with current liberty
* session.
* It will need to have a valid single sign on token (generated through
* the liberty SSO). It is for a service provider in a root realm.
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param entityID Hosted Provider's entity ID
* @return <code>FSAccountFedInfo</code> associated with this session.
* <code>null</code> if there is any failure, or no liberty session
* is found.
* @deprecated This method is deprecated.
* @see #getAccountFedInfo(HttpServletRequest,String,String,String)
*/
{
return getAccountFedInfo(
}
/**
* Returns the federation information associated with current liberty
* session.
* It will need to have a valid single sign on token (generated through
* the liberty SSO).
*
* @param request <code>HttpServletRequest</code> associated with a user
* session.
* @param realm the realm in which the provider resides
* @param entityID Hosted Provider's entity ID
* @param providerRole the role of the provider
* @return <code>FSAccountFedInfo</code> associated with this session.
* <code>null</code> if there is any failure, or no liberty session
* is found.
*/
{
return null;
}
try {
if (debug.messageEnabled()) {
+ ": Theres no liberty session for this token");
}
return null;
}
return session.getAccountFedInfo();
" Exception while retrieving federation info.", ex);
return null;
}
}
/**
* Returns <code>providerRole</code> from the <code>ProviderAlias</code>
* using <code>meta Mgmt</code> calls.
*
* @param metaAlias The <code>metaAlias</code> of the provider
* @return <code>providerRole</code> corresponding to the
* <code>metaAlias</code>.
*/
try {
if (metaManager == null) {
return null;
}
} catch (IDFFMetaException ame) {
"Provider Role", ame);
return null;
}
}
/**
* Returns <code>NameIdentifier</code> between the IDP and
* the other SP for the same principal. This method should
* be used by the code on the hosted SP, where the user
* has logged in, and has an account linking with the IDP.
* Futhermore, the same principal has an account linking
* account.
*
* @param hostedSPMetaAlias The <code>metaAlias</code> of
* the local service provider.
* @param ssoToken The session token of the logged-
* in user on the local service provider.
* @param remoteSPEntityID The entity ID of the remote
* service provider. In other words, it is the targeted
* name space for the returned name identifier.
* @return <code>NameIdentifier</code> of the same principal
* but original established between the remote SP and
* the IDP
*/
{
if (debug.messageEnabled()) {
"NameMappingRequester: hostedEntityID="+
);
}
try {
} catch (IDFFMetaException ie) {
return null;
}
try {
} catch (SessionException ssoe) {
"SessionException caught when trying to "+
"get user DN from session token:", ssoe
);
return null;
}
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
"targetNamespace (remoteSPEntityID)=" +
}
}
} else {
return null;
}
}
if (debug.messageEnabled()) {
classMethod + "Remote IDP EntityID = " +
}
try {
true);
} catch (Exception e) {
"Exception caught when trying to get Name "+
"Identifier between local SP and remote IDP: ",
e);
return null;
}
if (debug.messageEnabled()) {
"Name Identifier between local SP and " +
}
try {
mappingRequest = new
ni,
return null;
}
if (FSServiceUtils.isSigningOn()) {
try {
} catch (SAMLException se) {
return null;
}
}
try {
} catch (IDFFMetaException fme1) {
return null;
}
if (debug.messageEnabled()) {
"IDP's soap end point=" +
}
try {
} catch (FSMsgException mex) {
return null;
return null;
return null;
}
try {
} catch (FSMsgException fme2) {
return null;
}
if (debug.messageEnabled()) {
try {
} catch (FSMsgException fme3)
{
return null;
}
"NameIdentifierMappingResponse: " +
resStr);
}
if (FSServiceUtils.isSigningOn()) {
if (FSNameMappingHandler.
if (debug.messageEnabled()) {
"Success in verifying Name Identifier Mapping"+
" Response Signature");
}
} else {
"Failed verifying Name Identifier Mapping "+
"Response");
return null;
}
}
return mappingResponse.getNameIdentifier();
}
}