Home:ALL Converter>Can not get HTTP Header in COGNOS Custom Authentication provider

Can not get HTTP Header in COGNOS Custom Authentication provider

Ask Time:2012-09-22T03:45:47         Author:user961954

Json Formatter

I am working on implementing COGNOS Custom Authentication provider (Java) with SSO (Oracle Access manager(OAM)).

The way OAM works is that it looks for a Valid Session Token Cookie in every HTTP/HTTPS request and when not found it redirects to the OAM log in page.

If the cookie is valid/authorized, it also a adds a HTTP HEADER and sets the user name in it and redirects to Cognos URL. Cognos now send this call to Custom Authentication Provider.

Now my problem is that I am not able to read this Header value inside Custom Authentication Provider. I tried adding a ASP page and it can read the values this proves that values are being passed and their is some problem with the way I am doing this in CAP Java code.

Snippet from code I am trying to use.

Note: I can get the cookie fine but all the headers are always NULL. Note2: I have tried using both INamespaceAuthenticationProvider/IBiBusHeader and INamespaceAuthenticationProvider2/IBiBusHeader2

public class CAPClass extends Namespace
    implements INamespaceAuthenticationProvider
{
    private String GetSingleValue(String[] value)
    {
        if(value != null && value.length > 0)
            return value[0];
        else
            return null;
    }

    public void createLogs(String var, IBiBusHeader theAuthRequest)
    {
        CreateLog.LogMsg(var + ": " + GetSingleValue(theAuthRequest.getEnvVarValue(var)));
        CreateLog.LogMsg(var + ": " + GetSingleValue(theAuthRequest.getTrustedEnvVarValue(var)));
        CreateLog.LogMsg(var + ": " + GetSingleValue(theAuthRequest.getCredentialValue(var)));
        //CreateLog.LogMsg(var + ": " + GetSingleValue(theAuthRequest.getTrustedCredentialValue(var))); 
    }

    public IVisa logon(IBiBusHeader theAuthRequest)
            throws UserRecoverableException, SystemRecoverableException,
            UnrecoverableException
    {
        String var = "ObSSOCookie";
        String SessTok = GetSingleValue(theAuthRequest.getCookieValue(var));
        CreateLog.LogMsg(var + ": " + SessTok);

        var = "REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HTTP_REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HEADER_REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HEADER_HTTP_REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HTTP_HEADER_REMOTE_USER";
        createLogs(var, theAuthRequest); 
        var = "SSO_LOGIN_ID";
        createLogs(var, theAuthRequest); 
        var = "HTTP_SSO_LOGIN_ID";
        createLogs(var, theAuthRequest); 
        var = "HEADER_SSO_LOGIN_ID";
        createLogs(var, theAuthRequest); 
        var = "HEADER_HTTP_SSO_LOGIN_ID";
        createLogs(var, theAuthRequest); 
        var = "HTTP_HEADER_SSO_LOGIN_ID";
        createLogs(var, theAuthRequest); 
        var = "OAM_REMOTE_USER";
        createLogs(var, theAuthRequest); 
        var = "HTTP_OAM_REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HEADER_OAM_REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HEADER_HTTP_OAM_REMOTE_USER";
        createLogs(var, theAuthRequest);
        var = "HTTP_HEADER_OAM_REMOTE_USER";
        createLogs(var, theAuthRequest);
    }
}

Author:user961954,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12537218/can-not-get-http-header-in-cognos-custom-authentication-provider
yy