Java Code Examples for org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext#setContextIdIncludedQueryParams()

The following examples show how to use org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext#setContextIdIncludedQueryParams() . 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: DefaultRequestCoordinator.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
private void buildOutboundQueryString(HttpServletRequest request, AuthenticationContext context)
        throws FrameworkException {

    // Build the outbound query string that will be sent to the authentication endpoint and
    // federated IdPs
    StringBuilder outboundQueryStringBuilder = new StringBuilder();
    outboundQueryStringBuilder.append(FrameworkUtils.getQueryStringWithConfiguredParams(request));

    if (StringUtils.isNotEmpty(outboundQueryStringBuilder.toString())) {
        outboundQueryStringBuilder.append("&");
    }

    try {
        outboundQueryStringBuilder.append("sessionDataKey=").append(context.getContextIdentifier())
                .append("&relyingParty=").append(URLEncoder.encode(context.getRelyingParty(), "UTF-8"))
                .append("&type=").append(context.getRequestType()).append("&")
                .append(FrameworkConstants.REQUEST_PARAM_SP).append("=")
                .append(URLEncoder.encode(context.getServiceProviderName(), "UTF-8")).append("&isSaaSApp=")
                .append(context.getSequenceConfig().getApplicationConfig().isSaaSApp());
    } catch (UnsupportedEncodingException e) {
        throw new FrameworkException("Error while URL Encoding", e);
    }

    if (log.isDebugEnabled()) {
        log.debug("Outbound Query String: " + outboundQueryStringBuilder.toString());
    }

    context.setContextIdIncludedQueryParams(outboundQueryStringBuilder.toString());
    context.setOrignalRequestQueryParams(outboundQueryStringBuilder.toString());
}
 
Example 2
Source File: DefaultRequestCoordinator.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
private void buildOutboundQueryString(HttpServletRequest request, AuthenticationContext context)
        throws FrameworkException {

    // Build the outbound query string that will be sent to the authentication endpoint and
    // federated IdPs
    StringBuilder outboundQueryStringBuilder = new StringBuilder();
    outboundQueryStringBuilder.append(FrameworkUtils.getQueryStringWithConfiguredParams(request));

    if (StringUtils.isNotEmpty(outboundQueryStringBuilder.toString())) {
        outboundQueryStringBuilder.append("&");
    }

    try {
        outboundQueryStringBuilder.append("sessionDataKey=").append(context.getContextIdentifier())
                .append("&relyingParty=").append(URLEncoder.encode(context.getRelyingParty(), "UTF-8")).append("&type=")
                .append(context.getRequestType()).append("&sp=")
                .append(URLEncoder.encode(context.getServiceProviderName(), "UTF-8")).append("&isSaaSApp=")
                .append(context.getSequenceConfig().getApplicationConfig().isSaaSApp());
    } catch (UnsupportedEncodingException e) {
        throw new FrameworkException("Error while URL Encoding", e);
    }

    if (log.isDebugEnabled()) {
        log.debug("Outbound Query String: " + outboundQueryStringBuilder.toString());
    }

    context.setContextIdIncludedQueryParams(outboundQueryStringBuilder.toString());
    context.setOrignalRequestQueryParams(outboundQueryStringBuilder.toString());
}