【问题标题】:Worklight Authenticity工作灯真实性
【发布时间】:2015-01-19 20:39:43
【问题描述】:

我们正在 Worklight 上开发一个混合应用程序,我们需要实现应用程序的真实性。 我们将 Worklight Enterprise 版本 6.2.0.1 与 IBM 应用程序中心一起使用。 但是,当我们在 Android 上启动应用程序时,我们在服务器日志中看到以下错误(iOS 也一样,但会提供 Android 日志)。

[1/19/15 15:25:05:388 EST] 00000254 WLNewAuthenti E com.worklight.core.auth.ext.appauth.WLNewAuthenticityScheme isInvalidAndroidParams FWLSE0260E:android 真实性检查的 packageName 缺失或为空,无法测试真实性。如果在 Worklight Console 中未将应用程序身份验证设置为“已禁用”或“已启用,正在服务”,则请求将失败。 [项目移动应用] [1/19/15 15:25:05:388 EST] 00000254 WLNewAuthenti E com.worklight.core.auth.ext.appauth.WLNewAuthenticityScheme isInvalidAndroidParams FWLSE0260E:用于 android 真实性检查的 publicsigningkey 缺失或为空,无法测试真实性。如果在 Worklight Console 中未将应用程序身份验证设置为“已禁用”或“已启用,正在服务”,则请求将失败。 [项目 MobileBanking]。

authenticationConfig.xml 的安全测试是:

<securityTests>
    <mobileSecurityTest name="MobileAppTestMobile">
        <testAppAuthenticity/>
        <testDeviceId provisioningType="auto" />
        <testUser realm="MobileAppRealm" />
        <testDirectUpdate mode="perSession" />
    </mobileSecurityTest>

    <webSecurityTest name="MobileAppTest">
        <testUser realm="MobileAppRealm" />
    </webSecurityTest>
    <customSecurityTest name="SubscribeServlet">
        <test realm="SubscribeServlet" isInternalUserID="true"/>
    </customSecurityTest>           

</securityTests> 

application-descriptor.xml:

<iphone bundleId="ca.company.MobileApp" securityTest="MobileAppTestMobile" version="1.0">
    <worklightSettings include="false"/>
    <security>
        <encryptWebResources enabled="true"/>
        <testWebResourcesChecksum enabled="true" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
    </security>
</iphone>
<android securityTest="MobileAppTestMobile" version="1.0">
    <worklightSettings include="false"/>
    <security>
        <encryptWebResources enabled="true"/>
        <testWebResourcesChecksum enabled="true" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
        <publicSigningKey>"We have added our public signing key here by extracting it from our keystore file"</publicSigningKey>
    </security>
</android>

更新 WAR 文件后,我们已经从头开始部署了所有应用程序。 worklight 控制台显示真实性的三个值“禁用 - 启用、服务 - 启用、阻止”

当我们输入“已启用,阻止”或“已启用,正在服务”时,我们会在帖子顶部共享的服务器上获取错误日志。 在应用程序屏幕上,我们收到一个错误“处理来自应用程序的请求时遇到错误”。

请指教。 谢谢

【问题讨论】:

    标签: ibm-mobilefirst worklight-security


    【解决方案1】:

    问题已解决。

    解决方案:

    1- 我们将 authenticationConfig.xml 中的 MobileSecurityTest 更改为 customSecurityTest,如下所示,并重新部署了 WAR 文件:

    <customSecurityTest name="MobileSecurityTest">
            <test realm="wl_antiXSRFRealm" step="1"/>
            <test realm="wl_authenticityRealm" step="1"/>
            <test realm="wl_remoteDisableRealm" step="1"/>
            <test realm="wl_directUpdateRealm" mode="perSession" step="1"/>
            <test realm="wl_anonymousUserRealm" isInternalUserID="true" step="1"/>
            <test realm="wl_deviceNoProvisioningRealm" isInternalDeviceID="true" step="2"/>
        </customSecurityTest>
    

    2- 在 application-descriptor.xml 中:

    对于 android,我使用了 Idan 所说的添加 &lt;packageName&gt; 属性。

    <android securityTest="MobileSecurityTest" version="1.0">
        <worklightSettings include="false"/>
        <security>
            <encryptWebResources enabled="true"/>
            <testWebResourcesChecksum enabled="true" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
            <publicSigningKey>"Our public signing Key placed here"</publicSigningKey>
            <packageName>ca.company.MobileTest</packageName>
        </security>
    </android>
    

    对于 iOS,问题出在 applicationId 中,我们认为 applicationId 值是 bundleId 的最后一部分,

    例如:如果 bundleId 是“com.company.Myapp”,这意味着 applicaiotnId 是“Myapp”,这是不正确的。

    这是不正确的定义:

    <iphone bundleId="ca.company.MobileTestiPhone" applicationId="MobileTestiPhone" securityTest="MobileSecurityTest" version="1.0" >
    

    applicationId 是 worklight.plist 文件中的值,该文件位于 iPhone 或 iPad 本机文件夹中,该文件是在构建后生成的。 而且对于我们的应用程序,它具有完全不同的价值。

    正确的是:

    <iphone bundleId="ca.company.MobileTestiPhone" applicationId="MobileTest" securityTest="MobileSecurityTest" version="1.0" >
    

    这就是当我们将应用真实性值设置为“启用,阻止”时应用被我们的 WL 服务器阻止的原因。

    感谢@Idan 的帮助。

    【讨论】:

      【解决方案2】:

      根据错误消息,您缺少 Android 包名称(在 application-descriptor.xml 中)。

      This is the Authenticity tutorial for Hybrid apps 适用于 v6.3,但对于 6.2 相同。来自 Android 说明:

      从包属性中获取应用程序包名值 AndroidManifest.xml 中的清单节点。如果你决定改变 值到另一个,验证您在两个位置都更改了它。您 也可以直接编辑 application-descriptor.xml 并添加一个 包名:

      <android version="1.0">
              <worklightSettings include="false"/>
              <security>
                  <encryptWebResources enabled="false"/>
                  <testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/>
                  <publicSigningKey>MIGff ...</publicSigningKey>
                  <packageName>com.MyBankApp</packageName>
              </security>
      </android>
      

      【讨论】:

      • 我添加了 packageName 并按照 URL 中提到的相同步骤操作,但仍然出现相同的错误。如果authenticationConfig.xml 正确,请您确认一下吗?
      • 确保重新部署 .war 和 .wlapp 文件。或者重新开始。
      • 它实际上并没有起作用,我们正在通过 PMR 来跟踪 IBM 的问题,以澄清它。当我们收到回复时,将用解决方案更新我的问题。感谢您的帮助。
      猜你喜欢
      • 2013-07-22
      • 1970-01-01
      • 2020-03-21
      • 1970-01-01
      • 1970-01-01
      • 2016-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多