无法在COGNOS自定义身份验证提供程序中获取HTTP标头

时间:2012-09-21 19:45:48

标签: cognos cognos-8 cognos-bi

我正在使用SSO(Oracle Access Manager(OAM))实现COGNOS自定义身份验证提供程序(Java)。

OAM的工作方式是在每个HTTP / HTTPS请求中查找有效会话令牌Cookie,如果没有找到,它会重定向到OAM登录页面。

如果cookie有效/已授权,它还会添加HTTP HEADER并在其中设置用户名并重定向到Cognos URL。 Cognos现在将此调用发送到自定义身份验证提供程序。

现在我的问题是我无法在自定义身份验证提供程序中读取此标头值。 我尝试添加一个ASP页面,它可以读取这些值,证明值正在传递,这与我在CAP Java代码中执行此操作的方式存在一些问题。

我尝试使用的代码片段。

注意:我可以很好地获取cookie,但所有标题始终为NULL。 注2:我尝试过使用INamespaceAuthenticationProvider / IBiBusHeader和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);
    }
}

1 个答案:

答案 0 :(得分:0)