IBM Worklight 5.0.5 - 无法在混合应用程序中启用应用程序真实性

时间:2013-08-08 18:37:25

标签: android ibm-mobilefirst worklight-security

我一直在尝试实现和测试Worklight的应用程序真实性功能,并且未能成功运行它。我已经回顾了本网站上的每篇文章,以及WL信息中心的信息,但没有成功。我正在详细解释我所做的事情,以及我所看到的结果,希望有人能够帮助我。

环境: Windows 7企业版上安装的Worklight Studio 5.0.5 Consumer Edition Windows 7企业版上安装的Worklight Server 5.0.5 Consumer Edition

WL服务器在Worklight Server安装提供的Websphere Application Server Liberty配置文件中运行

WL服务器正在使用安装包提供的derby数据库。

实施步骤:

  1. 在authenticationConfig.xml

    中添加(取消注释)安全测试
    <mobileSecurityTest name="mobileTests"> 
        <testDeviceId provisioningType="none"/>
        <testAppAuthenticity/>
        <testUser realm="wl_anonymousUserRealm"/>
    </mobileSecurityTest>
    
  2. 将.war文件重建并部署到Worklight Server。

  3. 修改initOptions.js以便“connectOnStartup:true”

  4. 修改了application-descriptor.xml并为Android应用程序指定了安全性测试并添加了publicSigningKey

    <android version="1.1" securityTest="mobileTests">
    <worklightSettings include="false"/>
    <security>
        <encryptWebResources enabled="false"/>
        <testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
        <publicSigningKey>.......</publicSigningKey>
    </security>
    

  5. 将应用程序重建并部署到WL服务器。

  6. 创建已签名的.apk文件并将其上传到应用程序中心。

  7. 在物理设备上安装应用程序(Samsung Galaxy Tab 2,Android 4.1.1)

  8. 启动该应用程序。

  9. 当我从WL控制台或物理设备上以“预览”模式启动应用程序时,我最终会显示相同的错误。我收到的错误是:

    {“errorCode”:“UNEXPECTED_ERROR”,“errorMsg”:“userIdentityForAPI为null。检查应用程序的身份验证要求(从不,onStartup,onDemand)。这些设置必须与已部署的应用程序匹配”}

    我的配置中是否遗漏了一些内容?

1 个答案:

答案 0 :(得分:0)

使用最新的Worklight Studio Consumer Edition插件v6.0.0.1,我完成了以下操作。我已经成功地在基于Worklight的Android应用环境中使用App Authenticity。

  1. 创建了一个新的Worklight项目
  2. 添加了Android环境
  3. initOptions.js&gt; connectOnStartup:true
  4. authenticationConfig.xml&gt;取消注释mobileSecurityTest:

    <mobileSecurityTest name="mobileTests">          
        <testAppAuthenticity/> 
        <testDeviceId provisioningType="none" />  
    </mobileSecurityTest>
    

    也可以使用自定义安全测试:

    <customSecurityTest name="customTests">
              <test realm="wl_antiXSRFRealm" step="1"/>
              <test realm="wl_authenticityRealm" step="1"/>
              <test realm="wl_remoteDisableRealm" step="1"/>
              <test realm="wl_anonymousUserRealm" isInternalUserID="true" step="1"/>
          test realm="wl_deviceNoProvisioningRealm" isInternalDeviceID="true" step="2"/>
     </customSecurityTest>
    
  5. 使用默认的Google提供的debug.keystore(在生产环境中,使用应使用自己的密钥库)

  6. 通过右键单击Android文件夹&gt;使用此密钥库;提取公共签名密钥(自动添加到application-descriptor.xml)
  7. 构建全部和部署
  8. 右键点击生成的Android项目&gt;运行方式&gt; Android应用程序(在生产环境中,右键单击生成的Android项目&gt; Android工具&gt;导出签名的应用程序包&gt;安装签名的.apk&gt;启动)
  9. 验证:

    1. 当应用验证规则在Worklight Console中设置为“已启用”时,检查应用是否设法连接到Worklight Server
    2. 修改application-descriptor.xml中的公共签名密钥并重新部署到服务器
    3. 当应用验证规则在Worklight Console中设置为Enabled, blocking时,检查应用现在无法连接到Worklight Server
    4. 如果设置为Enabled, serving
    5. ,则检查应用程序是否通过
    6. 如果设置为Disabled
    7. ,则检查应用程序是否通过

      在我的测试中:

      • 我在Windows 7中使用了Worklight Studio Consumer Edition(使用嵌入式Liberty应用程序服务器),而不是将Worklight Server部署到的单独应用程序服务器。只要完成上述相同的步骤(稍作更改 - 也需要部署.wlapp),我看不出任何差异......
      • 确保正确获得密钥库部分;也就是说,在服务器和应用程序中使用相同的密钥库。