2014-10-06 70 views
0

我的理解是worklight提供的認證機制是基於需求的 - 當你訪問一些受保護的資源時,客戶端ChallengeHandler將被調用。worklight client connect()來調用ChallengeHandler

但是,我們遇到了一個非常奇怪的情況 - 只要客戶端調用WLClient :: connect方法,挑戰處理程序就會被調用。我們甚至還沒有開始調用適配器方法。

認證-config.xml中

<?xml version="1.0" encoding="UTF-8"?> 
<tns:loginConfiguration xmlns:tns="http://www.worklight.com/auth/config" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

    <!-- Licensed Materials - Property of IBM 5725-I43 (C) Copyright IBM Corp. 
     2006, 2013. All Rights Reserved. US Government Users Restricted Rights - 
     Use, duplication or disclosure restricted by GSA ADP Schedule Contract with 
     IBM Corp. --> 

    <securityTests> 

     <mobileSecurityTest name="UserAuthSecurityTest"> 
      <testUser realm="UserAuthRealm" /> 
     </mobileSecurityTest> 

     <mobileSecurityTest name="PushNotificationSecurityTest"> 
      <testUser realm="UserAuthRealm" /> 
      <testDeviceId provisioningType="none" /> 
     </mobileSecurityTest> 

    </securityTests> 

    <realms> 

     <realm loginModule="AuthLoginModule" name="UserAuthRealm"> 
      <className>com.worklight.integration.auth.AdapterAuthenticator</className> 
      <parameter name="login-function" value="UserAuthAdapter.onAuthRequired" /> 
      <parameter name="logout-function" value="UserAuthAdapter.onLogout" /> 
     </realm> 

    </realms> 

    <loginModules> 

     <loginModule name="AuthLoginModule"> 
      <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className> 
     </loginModule> 

    </loginModules> 

</tns:loginConfiguration> 

應用descriptor.xml

<android securityTest="PushNotificationSecurityTest" version="3.0.1"> 
    <worklightSettings include="false"/> 
    <pushSender key="..." senderId="..."/> 
    <security> 
     <encryptWebResources enabled="false"/> 
     <testWebResourcesChecksum enabled="false" ignoreFileExtensions="png, jpg, jpeg, gif, mp4, mp3"/> 
     <publicSigningKey>........</publicSigningKey> 
    </security> 
</android> 
+0

authenticationConfig.xml不顯示或幫助。您是否在application-descriptor.xml中的環境中設置了securityTest?如果你有,這將解釋。 – 2014-10-06 15:11:03

+0

@IdanAdar您是否在談論securityTest是這個「全局認證」的根本原因?我馬上試試這個 – Qylin 2014-10-06 15:22:11

+0

這就是我所說的。 – 2014-10-06 15:22:37

回答

1

你有沒有在應用程序descriptor.xml的環境設置securityTest?如果你有,這將解釋它。

在application-descriptor.xml中的環境中聲明的安全測試將觸發應用程序啓動時的身份驗證。

+0

伊丹阿達爾太棒了!奇怪的是我在關於這個的官方6.1文檔中找不到任何解釋。無論如何,Idan是對的。 – Qylin 2014-10-06 15:46:05

相關問題