use of com.sun.identity.federation.services.FSSessionManager in project OpenAM by OpenRock.
the class FSAssertionConsumerService method getInResponseToRequest.
private FSAuthnRequest getInResponseToRequest(String requestID, String metaAlias) {
FSUtils.debug.message("FSAssertionConsumerService::getInResponseToRequest: Called");
FSSessionManager sessionManager = FSSessionManager.getInstance(metaAlias);
return sessionManager.getAuthnRequest(requestID);
}
use of com.sun.identity.federation.services.FSSessionManager in project OpenAM by OpenRock.
the class IDFFSingleLogoutHandler method handleSOAPInitiatedSingleLogout.
private int handleSOAPInitiatedSingleLogout(Set userSession, String userID, HttpServletRequest request, HttpServletResponse response, String realm, String idpMetaAlias, String idpEntityId, String relayState, IDFFMetaManager metaManager) throws Exception {
// TODO : verify this works under LB
Object ssoToken = null;
if ((userSession != null) && !userSession.isEmpty()) {
// TODO : handle multiple SSO token case
ssoToken = (Object) userSession.iterator().next();
} else {
FSSessionManager manager = FSSessionManager.getInstance(idpMetaAlias);
List sessions = manager.getSessionList(userID);
if ((sessions != null) && !sessions.isEmpty()) {
// TODO : handle multiple SSO token case
ssoToken = sessions.iterator().next();
} else {
return SingleLogoutManager.LOGOUT_NO_ACTION_STATUS;
}
}
// call Single Logout Handler
FSUtils.debug.message("creating FSSingleLogoutHandler");
HashMap providerMap = FSLogoutUtil.getCurrentProvider(userID, idpEntityId, ssoToken);
if (providerMap != null) {
FSSessionPartner currentSessionProvider = (FSSessionPartner) providerMap.get(IFSConstants.PARTNER_SESSION);
String sessionIndex = (String) providerMap.get(IFSConstants.SESSION_INDEX);
if (currentSessionProvider != null) {
ProviderDescriptorType hostedProviderDesc = metaManager.getIDPDescriptor(realm, idpEntityId);
BaseConfigType hostedConfig = metaManager.getIDPDescriptorConfig(realm, idpEntityId);
FSSingleLogoutHandler handlerObj = new FSSingleLogoutHandler();
handlerObj.setHostedDescriptor(hostedProviderDesc);
handlerObj.setHostedDescriptorConfig(hostedConfig);
handlerObj.setHostedEntityId(idpEntityId);
handlerObj.setHostedProviderRole(IFSConstants.IDP);
handlerObj.setMetaAlias(idpMetaAlias);
handlerObj.setSingleLogoutProtocol(IFSConstants.LOGOUT_IDP_SOAP_PROFILE);
handlerObj.setRelayState(relayState);
handlerObj.setRealm(realm);
FSLogoutStatus logoutStatus = handlerObj.handleSingleLogout(response, request, currentSessionProvider, userID, sessionIndex, false, ssoToken);
if (SingleLogoutManager.debug.messageEnabled()) {
SingleLogoutManager.debug.message("IDFFSLOHandler." + "handleSOAPInitiatedSLO: logout status=" + logoutStatus.toString());
}
if (logoutStatus.getStatus().equalsIgnoreCase(IFSConstants.SAML_SUCCESS)) {
return SingleLogoutManager.LOGOUT_SUCCEEDED_STATUS;
} else {
return SingleLogoutManager.LOGOUT_FAILED_STATUS;
}
}
}
return SingleLogoutManager.LOGOUT_NO_ACTION_STATUS;
}
use of com.sun.identity.federation.services.FSSessionManager in project OpenAM by OpenRock.
the class LibertyManager method getAuthnContext.
/**
* 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.
*/
public static String getAuthnContext(HttpServletRequest request, String realm, String entityID) {
if (request == null || entityID == null) {
debug.message("LibertyManager.getAuthnContext: null Input params");
return null;
}
try {
Object token = SessionManager.getProvider().getSession(request);
FSSessionManager sessionManager = FSSessionManager.getInstance(getMetaAlias(realm, entityID, IFSConstants.SP));
FSSession session = sessionManager.getSession(token);
if (session == null) {
if (debug.messageEnabled()) {
debug.message("LibertyManager.getAuthnContext" + ": There is no liberty session for this token");
}
return null;
}
return session.getAuthnContext();
} catch (Exception ex) {
FSUtils.debug.error("LibertyManager.getAuthnContext" + " Exception while retrieving authncontext.", ex);
return null;
}
}
Aggregations