Java Code Examples for org.wso2.carbon.identity.application.authentication.framework.util.FrameworkUtils#removeAuthenticationResultFromCache()

The following examples show how to use org.wso2.carbon.identity.application.authentication.framework.util.FrameworkUtils#removeAuthenticationResultFromCache() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdentityProcessor.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Processes the IdentityMessageContext and retrieved the using {@code sessionDataKey} parameter and sets the
 * AuthenticationResult to message context if found in AuthenticationResultCache
 *
 * @param context IdentityMessageContext
 * @param identityRequest Current IdentityRequest object
 * @return AuthenticationResult
 */
protected AuthenticationResult processResponseFromFrameworkLogin(IdentityMessageContext context,
                                                                 IdentityRequest identityRequest) {

    String sessionDataKey = identityRequest.getParameter(InboundConstants.RequestProcessor.CONTEXT_KEY);
    AuthenticationResultCacheEntry entry = FrameworkUtils.getAuthenticationResultFromCache(sessionDataKey);
    AuthenticationResult authnResult = null;
    if(entry != null) {
        authnResult = entry.getResult();
    } else {
        throw FrameworkRuntimeException.error("Cannot find AuthenticationResult from the cache");
    }
    FrameworkUtils.removeAuthenticationResultFromCache(sessionDataKey);
    if (authnResult.isAuthenticated()) {
        context.addParameter(InboundConstants.RequestProcessor.AUTHENTICATION_RESULT, authnResult);
    }
    return authnResult;
}
 
Example 2
Source File: PassiveSTS.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


    String sessionDataKey = req.getParameter(SESSION_DATA_KEY);
    if (sessionDataKey != null) {
        handleResponseFromAuthenticationFramework(req, resp);
        FrameworkUtils.removeAuthenticationResultFromCache(sessionDataKey);
    } else if ("wsignout1.0".equals(getAttribute(req.getParameterMap(), PassiveRequestorConstants.ACTION))) {
        handleLogoutRequest(req, resp);
    } else {
        handleAuthenticationRequest(req, resp);
    }
}
 
Example 3
Source File: OAuth2AuthzEndpoint.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Remove authentication result from request
 * @param req
 */
private void removeAuthenticationResult(HttpServletRequest req, String sessionDataKey) {

    if(isCacheAvailable){
        FrameworkUtils.removeAuthenticationResultFromCache(sessionDataKey);
    }else {
        req.removeAttribute(FrameworkConstants.RequestAttribute.AUTH_RESULT);
    }
}
 
Example 4
Source File: SAMLSSOProviderServlet.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
/**
 * Remove authentication result from request
 * @param req
 */
private void removeAuthenticationResult(HttpServletRequest req, String sessionDataKey) {

        FrameworkUtils.removeAuthenticationResultFromCache(sessionDataKey);
        req.removeAttribute(FrameworkConstants.RequestAttribute.AUTH_RESULT);
}