Search in sources :

Example 1 with PAOSHeader

use of com.sun.identity.liberty.ws.paos.PAOSHeader in project OpenAM by OpenRock.

the class SPSSOFederate method isFromECP.

/**
     * Checks if the request is from ECP.
     *
     * @param request the HttpServletRequest.
     * @return true if the request is from ECP.
     */
public static boolean isFromECP(HttpServletRequest request) {
    PAOSHeader paosHeader = null;
    try {
        paosHeader = new PAOSHeader(request);
    } catch (PAOSException pex) {
        if (SAML2Utils.debug.messageEnabled()) {
            SAML2Utils.debug.message("SPSSOFederate.initiateECPRequest:" + "no PAOS header");
        }
        return false;
    }
    Map svcOpts = paosHeader.getServicesAndOptions();
    if ((svcOpts == null) || (!svcOpts.containsKey(SAML2Constants.PAOS_ECP_SERVICE))) {
        if (SAML2Utils.debug.messageEnabled()) {
            SAML2Utils.debug.message("SPSSOFederate.initiateECPRequest:" + "PAOS header doesn't contain ECP service");
        }
        return false;
    }
    String acceptHeader = request.getHeader("Accept");
    if (acceptHeader == null) {
        return false;
    }
    return (acceptHeader.indexOf(PAOSConstants.PAOS_MIME_TYPE) != -1);
}
Also used : PAOSException(com.sun.identity.liberty.ws.paos.PAOSException) PAOSHeader(com.sun.identity.liberty.ws.paos.PAOSHeader) Map(java.util.Map)

Aggregations

PAOSException (com.sun.identity.liberty.ws.paos.PAOSException)1 PAOSHeader (com.sun.identity.liberty.ws.paos.PAOSHeader)1 Map (java.util.Map)1