简体   繁体   English

使用定制身份验证提供程序登录IBM Cognos SDK

[英]IBM Cognos SDK login with custom authentication provider

I am trying to login to cognos using the SDK but keep getting the following error: 我正在尝试使用SDK登录到cognos,但始终出现以下错误:

AxisFault
 faultCode: Client
 faultSubcode: 
 faultString: CM-REQ-4342 An error occurred with the client.
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://developer.cognos.com/schemas/bibus/3/}exception:
                    <severity>error</severity>
                    <errorCode>cmAuthenticateFailed</errorCode>
                    <ns1:message>
                        <messageString>CM-CAM-4005 Unable to authenticate. Check your security directory server connection and confirm the credentials entered at login.</messageString>
                    <detail>
                    <exception xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="bus:CAMException">
                        <severity xsi:type="bus:severityEnum">error</severity>
                        <errorCode>-36</errorCode>
                        <errorCodeString xml:space="preserve" xsi:type="xsd:string">camAuthUserRecoverable</errorCodeString>
                        <messages soapenc:arrayType="bus:message[2]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="SOAP-ENC:Array">
                            <item xsi:type="bus:message">
                                <messageString xml:space="preserve" xsi:type="xsd:string"/>
                            </item>
                            <item xsi:type="bus:message">
                                <nestingLevel xsi:type="xsd:integer">1</nestingLevel>
                                <messageString xml:space="preserve" xsi:type="xsd:string"> Enter your authentication credentials.</messageString>
                            </item>
                        </messages>
                        <promptInfo xsi:type="bus:promptInfo">
                            <captions soapenc:arrayType="xsd:string[2]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="SOAP-ENC:Array">
                                <item xml:space="preserve" xsi:type="xsd:string"/>
                                <item xml:space="preserve" xsi:type="xsd:string"> Enter your authentication credentials.</item>
                            </captions>
                            <displayObjects soapenc:arrayType="bus:displayObject[6]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="SOAP-ENC:Array">
                                <item xsi:type="bus:displayObject">
                                    <type xml:space="preserve" xsi:type="xsd:string">text</type>
                                    <name xml:space="preserve" xsi:type="xsd:string">FormUsername</name>
                                    <caption xml:space="preserve" xsi:type="xsd:string">User ID</caption>
                                </item>
                                <item xsi:type="bus:displayObject">
                                    <type xml:space="preserve" xsi:type="xsd:string">textnoecho</type>
                                    <name xml:space="preserve" xsi:type="xsd:string">FormUserPassword</name>
                                    <caption xml:space="preserve" xsi:type="xsd:string">Password</caption>
                                </item>
                                <item xsi:type="bus:displayObject">
                                    <type xml:space="preserve" xsi:type="xsd:string">singleselect</type>
                                    <name xml:space="preserve" xsi:type="xsd:string">CAMSiteName</name>
                                    <caption xml:space="preserve" xsi:type="xsd:string">Site</caption>
                                    <promptOptions soapenc:arrayType="bus:promptOption[1]" xsi:type="SOAP-ENC:Array">
                                        <item xsi:type="bus:promptOption">
                                            <id xml:space="preserve" xsi:type="xsd:string">1</id>
                                            <value xml:space="preserve" xsi:type="xsd:string">Mexico</value>
                                            <default xml:space="preserve" xsi:type="xsd:boolean">false</default>
                                        </item>
                                    </promptOptions>
                                </item>
                                <item xsi:type="bus:displayObject">
                                    <type xml:space="preserve" xsi:type="xsd:string">singleselect</type>
                                    <name xml:space="preserve" xsi:type="xsd:string">CAMAuthType</name>
                                    <caption xml:space="preserve" xsi:type="xsd:string">Authentication Type</caption>
                                    <promptOptions soapenc:arrayType="bus:promptOption[5]" xsi:type="SOAP-ENC:Array">
                                        <item xsi:type="bus:promptOption">
                                            <id xml:space="preserve" xsi:type="xsd:string">3</id>
                                            <value xml:space="preserve" xsi:type="xsd:string">AD/Kerberos </value>
                                            <default xml:space="preserve" xsi:type="xsd:boolean">false</default>
                                        </item>
                                        <item xsi:type="bus:promptOption">
                                            <id xml:space="preserve" xsi:type="xsd:string">1</id>
                                            <value xml:space="preserve" xsi:type="xsd:string">SRP</value>
                                            <default xml:space="preserve" xsi:type="xsd:boolean">true</default>
                                        </item>
                                        <item xsi:type="bus:promptOption">
                                            <id xml:space="preserve" xsi:type="xsd:string">6</id>
                                            <value xml:space="preserve" xsi:type="xsd:string">PKI</value>
                                            <default xml:space="preserve" xsi:type="xsd:boolean">false</default>
                                        </item>
                                        <item xsi:type="bus:promptOption">
                                            <id xml:space="preserve" xsi:type="xsd:string">5</id>
                                            <value xml:space="preserve" xsi:type="xsd:string">RSA SecurID</value>
                                            <default xml:space="preserve" xsi:type="xsd:boolean">false</default>
                                        </item>
                                        <item xsi:type="bus:promptOption">
                                            <id xml:space="preserve" xsi:type="xsd:string">4</id>
                                            <value xml:space="preserve" xsi:type="xsd:string">LDAP</value>
                                            <default xml:space="preserve" xsi:type="xsd:boolean">false</default>
                                        </item>
                                    </promptOptions>
                                </item>
                                <item xsi:type="bus:displayObject">
                                    <type xml:space="preserve" xsi:type="xsd:string">hidden</type>
                                    <name xml:space="preserve" xsi:type="xsd:string">h_CAM_action</name>
                                    <value xml:space="preserve" xsi:type="xsd:string">logonAs</value>
                                </item>
                                <item xsi:type="bus:displayObject">
                                    <type xml:space="preserve" xsi:type="xsd:string">hidden</type>
                                    <name xml:space="preserve" xsi:type="xsd:string">CAMNamespace</name>
                                    <value xml:space="preserve" xsi:type="xsd:string">BLNSProvider</value>
                                </item>
                            </displayObjects>
                        </promptInfo>
                    </exception>
                    </detail>
                    </ns1:message>

I know that my username and password are accurate. 我知道我的用户名和密码是正确的。

Here's the code, it's been ripped from here . 这是代码,已经从这里被撕掉

public class CognosTest {
    private static String dispatcherURL = "http://domain:port/p2pd/servlet/dispatch";
    private static String nameSpaceID = "BLNSProvider";
    private static String userName = "username";
    private static String password = "password";

    public static void main(String[] args) {
        ContentManagerService_PortType cmService = null;
        ContentManagerService_ServiceLocator cmServiceLocator = new ContentManagerService_ServiceLocator();
        StringBuffer credentialXML = new StringBuffer();
        String encodedCredentials;
        XmlEncodedXML xmlCredentials = new XmlEncodedXML();

        // Step 1. Connect to Cognos services
        try {
            URL url = new URL(dispatcherURL);
            cmService = cmServiceLocator.getcontentManagerService(url);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (ServiceException e) {
            e.printStackTrace();
        }

        // Step 2. Logon to Cognos.
        credentialXML.append("<credential>");
        credentialXML.append("<namespace>").append(nameSpaceID).append("</namespace>");
        credentialXML.append("<username>").append(userName).append("</username>");
        credentialXML.append("<password>").append(password).append("</password>");
        credentialXML.append("</credential>");

        encodedCredentials = credentialXML.toString();
        xmlCredentials.set_value(encodedCredentials);

        try {
            cmService.logon(xmlCredentials, null);
            SOAPHeaderElement temp = ((Stub)cmService).getResponseHeader("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader");
            BiBusHeader CMbibus = (BiBusHeader)temp.getValueAsType(new QName ("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader"));
            ((Stub)cmService).setHeader("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader", CMbibus);
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }

        // Step 3. Log out from Cognos.
        try {
            cmService.logoff();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

}

The difference between my code and the one in that document is the namespace id. 我的代码与该文档中的代码之间的区别是名称空间ID。 The cognos I'm trying to connect to, uses a custom Java authentication provider with the Java class name 我尝试连接的cognos使用具有Java类名称的自定义Java身份验证提供程序

com.bmc.bbds.auth.cognos.providers.BDSAuthenticationProvider

Any help is appreciated. 任何帮助表示赞赏。

The class name of the Custom Java Authentication Provider (CJAP) doesn't matter for SDK authentication purposes. 自定义Java身份验证提供程序(CJAP)的类名称与SDK身份验证无关。 The namespace ID is the relevant factor, which can be found in Cognos Configuration on the namespace node with the title "Namespace ID." 名称空间ID是相关因素,可以在标题为“名称空间ID”的名称空间节点上的Cognos Configuration中找到它。 Therefore, BLNSProvider may be the appropriate value. 因此, BLNSProvider可能是适当的值。

Based on the response from Cognos you included, it looks like your CJAP requires more fields than just your standard user name and password. 根据您所包含的Cognos的响应,您的CJAP似乎需要更多的字段,而不仅仅是标准的用户名和密码。 You would need to include entries for these values in your credentialXml object that you send as your authentication to successfully authenticate to Cognos with that CJAP. 您需要在作为身份验证发送的credentialXml对象中包含这些值的条目,以使用该CJAP成功向Cognos进行身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM