Class FSLogoutUtil
- java.lang.Object
-
- com.sun.identity.federation.services.logout.FSLogoutUtil
-
public class FSLogoutUtil extends Object
Utility class for single logout.
-
-
Constructor Summary
Constructors Constructor Description FSLogoutUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static booleancleanSessionMap(String userDn, String metaAlias, FSSession session)Cleans theFSSessionManagermaintained session for the given principal.static voidcleanSessionMapPartnerList(String userDN, String currentEntityId, String metaAlias, FSSession session)Cleans theFSSessionManagermaintained session for the given principal, provider Id and removes all references to the provider since logout notification has already been sent to that provider.protected static booleancleanSessionMapProviders(String userID, Vector sessionList, String metaAlias)Cleans theFSSessionManagermaintained session information for the user for the given list of sessions.protected static booleandestroyLocalSession(Object ssoToken, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)Destroys local session.protected static booleandestroyPrincipalSession(String userID, String metaAlias, String sessionIndex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)Destroys the principal's session.protected static HashMapgetCurrentProvider(String userID, String metaAlias)Returns the information for the given principal and one of the live connections (provider that received/issued assertion for this user) includingsessionIndex, provider Id etc.static HashMapgetCurrentProvider(String userID, String metaAlias, Object ssoToken)static HashMapgetCurrentProvider(String userID, String metaAlias, Object ssoToken, FSSession curSession)protected static FSAccountFedInfogetCurrentWorkingAccount(String userID, String entityID, String metaAlias)Returns theFSAccountFedInfoobject for the given principal and provider Id.protected static HashMapgetLogoutGETProviders(String userID, String entityId, String sessionIndex, String realm, String metaAlias)Returns the list of all providers who want to be notified of logout using HTTP GET profile.protected static VectorgetSessionObjectList(String userDn, String metaAlias, String sessionIndex)Gets the list of the principal's active sessionID that is maintained byFSSessionManager.static StringgetUserFromRequest(FSLogoutNotification reqLogout, String realm, String hostedEntityId, String hostedRole, com.sun.identity.federation.jaxb.entityconfig.BaseConfigType hostedConfig, String metaAlias)Determines the user name from the logout request.protected static ObjectgetValidToken(jakarta.servlet.http.HttpServletRequest request)Retrieves the session token from the Http Request, and validates the token with the OpenAM session manager.static booleanisIDPInitiatedProfile(String profile)Returns true if this is IDP initiated profiles, false otherwise.static booleanliveConnectionsExist(String userID, String metaAlias)Finds out if there is at least one more partner who should be notified of logoutstatic voidremoveCurrentSessionPartner(String metaAlias, String remoteEntityId, Object ssoToken, String userID)Removes current session partner from the session partner list.static voidremoveTokenFromSession(Object token, String metaAlias)protected static voidreturnToSource(jakarta.servlet.http.HttpServletResponse response, com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType remoteDescriptor, String bLogoutStatus, String commonErrorPage, int minorVersion, com.sun.identity.federation.jaxb.entityconfig.BaseConfigType hostedConfig, String hostedEntityId, String userID)Determines the return location and redirects based on logout Return URL of the provider that sent the logout request.protected static voidsendErrorPage(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String providerAlias)Returns the hosted provider's failure page to the user.
-
-
-
Method Detail
-
destroyPrincipalSession
protected static boolean destroyPrincipalSession(String userID, String metaAlias, String sessionIndex, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
Destroys the principal's session. In order to destroy the user's session the following things need to be done 1. Destroy the Federation Session cookie (eg. iPlanetDirectoryPro) 2. Clean the Session manager (FSSessionManager related API call)- Parameters:
userID- the principal whose session needs to be destroyedmetaAlias- the hostedProvider's meta alias.sessionIndex- Session Index of the user session.request- HTTP Request Object.response- HTTP Response Object.- Returns:
trueif session cleanup was successful;falseotherwise.
-
destroyLocalSession
protected static boolean destroyLocalSession(Object ssoToken, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
Destroys local session.- Parameters:
ssoToken- session of the principal- Returns:
trueif the local session is deleted;falseotherwise.
-
getSessionObjectList
protected static Vector getSessionObjectList(String userDn, String metaAlias, String sessionIndex)
Gets the list of the principal's active sessionID that is maintained byFSSessionManager.- Parameters:
userDn- the principal whose session needs to be destroyedmetaAlias- the hosted Entity doing logout cleanupsessionIndex- index of the user's session- Returns:
- Vector list of active Session IDs
-
cleanSessionMapPartnerList
public static void cleanSessionMapPartnerList(String userDN, String currentEntityId, String metaAlias, FSSession session)
Cleans theFSSessionManagermaintained session for the given principal, provider Id and removes all references to the provider since logout notification has already been sent to that provider.- Parameters:
userDN- the principal whose session needs to be destroyedcurrentEntityId- the provider to whom logout notification is about to be sentmetaAlias- the hostedProvider doing logout cleanupsession- Liberty session.
-
cleanSessionMap
protected static boolean cleanSessionMap(String userDn, String metaAlias, FSSession session)
Cleans theFSSessionManagermaintained session for the given principal. Logout notification has already been sent to all providers that had live connections for this user IfFSSessionis null, then it cleans up the user's all sessions.- Parameters:
userDn- the principal whose session needs to be destroyedmetaAlias- the hostedProvider doing logout cleanupsession- Liberty session.- Returns:
trueif session map cleaning was successful;falseotherwise.
-
getValidToken
protected static Object getValidToken(jakarta.servlet.http.HttpServletRequest request)
Retrieves the session token from the Http Request, and validates the token with the OpenAM session manager.- Parameters:
request-HTTPServletRequestobject containing the session cookie information- Returns:
- session token if request contained valid
session info;
falseotherwise.
-
getCurrentWorkingAccount
protected static FSAccountFedInfo getCurrentWorkingAccount(String userID, String entityID, String metaAlias)
Returns theFSAccountFedInfoobject for the given principal and provider Id.- Parameters:
userID- principal whose working account we want to retrieveentityID- the provider Id to whom logout notification needs to be sentmetaAlias- hosted provider's meta alias- Returns:
- account object for the given user, provider
-
getCurrentProvider
protected static HashMap getCurrentProvider(String userID, String metaAlias)
Returns the information for the given principal and one of the live connections (provider that received/issued assertion for this user) includingsessionIndex, provider Id etc.- Parameters:
userID- principal who needs to be logged outmetaAlias- the hostedProvider doing logout cleanup- Returns:
- HashMap information about live connection provider
-
getCurrentProvider
public static HashMap getCurrentProvider(String userID, String metaAlias, Object ssoToken)
-
getCurrentProvider
public static HashMap getCurrentProvider(String userID, String metaAlias, Object ssoToken, FSSession curSession)
-
liveConnectionsExist
public static boolean liveConnectionsExist(String userID, String metaAlias)
Finds out if there is at least one more partner who should be notified of logout- Parameters:
userID- principal who needs to be logged outmetaAlias- ther provider performing logout- Returns:
trueif any provider exists;falseotherwise.
-
cleanSessionMapProviders
protected static boolean cleanSessionMapProviders(String userID, Vector sessionList, String metaAlias)
Cleans theFSSessionManagermaintained session information for the user for the given list of sessions.- Parameters:
userID- principal who needs to be logged outsessionList- is the list of session Ids to be cleaned for the usermetaAlias- the provider performing logout- Returns:
- always return
true
-
getLogoutGETProviders
protected static HashMap getLogoutGETProviders(String userID, String entityId, String sessionIndex, String realm, String metaAlias)
Returns the list of all providers who want to be notified of logout using HTTP GET profile.- Parameters:
userID- principal who needs to be logged outentityId- current provider who uses HTTP GET profile for logoutsessionIndex- for the current providerrealm- the realm in which the provider residesmetaAlias- the hosted provider performing logout- Returns:
- HashMap list of providers who indicate preference to be notified of logout using GET profile
-
getUserFromRequest
public static String getUserFromRequest(FSLogoutNotification reqLogout, String realm, String hostedEntityId, String hostedRole, com.sun.identity.federation.jaxb.entityconfig.BaseConfigType hostedConfig, String metaAlias)
Determines the user name from the logout request.- Parameters:
reqLogout- the logout rerquest receivedrealm- the realm under which the entity resideshostedEntityId- the hosted provider performing logouthostedRole- the role of the hosted providerhostedConfig- extended meta config for hosted providermetaAlias- hosted provider's meta alias- Returns:
- user id if the user is found;
nullotherwise.
-
returnToSource
protected static void returnToSource(jakarta.servlet.http.HttpServletResponse response, com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType remoteDescriptor, String bLogoutStatus, String commonErrorPage, int minorVersion, com.sun.identity.federation.jaxb.entityconfig.BaseConfigType hostedConfig, String hostedEntityId, String userID)Determines the return location and redirects based on logout Return URL of the provider that sent the logout request.
-
sendErrorPage
protected static void sendErrorPage(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String providerAlias)Returns the hosted provider's failure page to the user.- Parameters:
request- theHttpServletRequestobjectresponse- theHttpServletResponseobjectproviderAlias- the provider alias corresponding to the hosted provider
-
removeCurrentSessionPartner
public static void removeCurrentSessionPartner(String metaAlias, String remoteEntityId, Object ssoToken, String userID)
Removes current session partner from the session partner list.- Parameters:
metaAlias- meta alias of the hosted providerremoteEntityId- id of the remote providerssoToken- session object of the principal who presently loginuserID- id of the principal
-
isIDPInitiatedProfile
public static boolean isIDPInitiatedProfile(String profile)
Returns true if this is IDP initiated profiles, false otherwise.- Parameters:
profile- profile to be checked.- Returns:
- true if specified profile is IDP initiated, false otherwise.
-
-