我的理解是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>
authenticationConfig.xml不顯示或幫助。您是否在application-descriptor.xml中的環境中設置了securityTest?如果你有,這將解釋。 – 2014-10-06 15:11:03
@IdanAdar您是否在談論securityTest是這個「全局認證」的根本原因?我馬上試試這個 – Qylin 2014-10-06 15:22:11
這就是我所說的。 – 2014-10-06 15:22:37