1

我试图让使用IBM工作灯工作室6.2.0.01工作灯LDAP身份验证注销从LDAPRealm

登录系统工作正常,那部分没有问题的LDAP认证系统,但注销功能实际上并不注销用户!

领域:

<realm loginModule="LDAPLoginModule" name="LDAPRealm"> 
    <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className> 
</realm> 

的LoginModule:

<loginModule name="LDAPLoginModule"> 
    <className>com.worklight.core.auth.ext.LdapLoginModule</className> 
    <parameter name="ldapProviderUrl" value="<Correct LDAP URL (For security left blank on stackoverflow)>"/> 
    <parameter name="ldapTimeoutMs" value="2000"/> 
    <parameter name="ldapSecurityAuthentication" value="simple"/> 
    <parameter name="validationType" value="exists"/> 
    <parameter name="ldapSecurityPrincipalPattern" value="{username}"/> 
</loginModule> 

SecurityTest:

<customSecurityTest name="LDAPSecurityTest"> 
    <test realm="wl_directUpdateRealm" step="1"/> 
    <test isInternalUserID="true" realm="LDAPRealm"/> 
</customSecurityTest> 

AdapterXML(重要部分)

<procedure name="getUsername" securityTest="LDAPSecurityTest" /> 
<procedure name="onLogout" /> 

AdapterJS

function getUsername(){ 
    return {username: ""}; 
} 

function onLogout(){ 
    WL.Server.setActiveUser("LDAPRealm", null); 
} 

的getUsername函数被调用每次应用程序要检查,如果用户当前已登录,它具有比其它任何功能。

的注销功能(应用端)

$scope.setUsername = function(){ 
    var invocationData = { adapter: "DummyAdapter", procedure: "getUsername"} 
    WL.Client.invokeProcedure(invocationData, { 
     onSuccess: function(result){}, 
     onFailure: function(result){); 
} 

$scope.logout = function(){ 
    WL.Client.logout("LDAPRealm", {onSuccess: $scope.setUsername}); 
} 

结果:这使得应用到登录页面被注意到的用户已注销,唯一的问题是..它没有完全注销用户。我能做些什么来使用户完全注销?

PS:为什么WL.Client.logout()之后不使用WL.Client.reloadApp?原因有两个:

  1. 白屏和重新加载整个应用程序只是肮脏的,它根本不是用户友好的。
  2. WL.Client.reloadApp在Android Lollipop(Android 5.0)上给出致命信号11(代码1)。至少,这是我的工作灯版本(6.2.0.01)。

,有没有方法可以让我避免WL.Client.reloadApp,仍然注销​​来自服务器的用户?如果不是:什么可能会导致Android Lollipop中的致命信号11(代码1)错误?我已经在iOS 8.0,Android 2.3.5,Android 4.4.2和Android 5.0上进行了彻底测试。只有一个失败是5.0

谢谢你,对不起,长期职位

+0

嗨。尽管我没有为您解决问题,但我确实想让您知道,WL.Client.reloadApp在Android 5.0中不起作用的错误正在调查中。感谢您的报告。 – 2014-11-04 07:18:56

+0

我已经找到了我的应用程序的解决方法,这涉及到根本不必使用WL.Client.reloadApp()。我也测试了WL.Client.reloadApp没有任何别的..我的意思是:没有AngularJS,没有离子,没有任何。只有纯CSS的HTML和JavaScript。它仍然只在android 5.0 – ErikBrandsma 2014-11-05 10:14:39

+0

崩溃谢谢。您能否将您的解决方案作为其他人从中受益的答案? – 2014-11-05 10:20:05

回答

1

我已经从注销的onSuccess取出WL.Client.reloadApp功能解决了这一问题,我这样做是这样的:

$scope.logout = function(){ 
     WL.Client.logout("LDAPRealm", {onSuccess: function(){ 
      $scope.setUsername() // <-- this function is the secret function 
           //  that triggers the securitytest 
           //  which then gives back the login page because 
           //  you had just logged out :) 
     }}); 
} 

至于没有注销用户的适配器:这个评论是错误的,这个错误是由另一个问题引起的。所以我发布在StackOverflow上的代码很好。但仍:

Android 5.0和WL.Client。reloadApp不好(2014年11月5日,以防更新修复此问题)

+0

编辑:即使WL.Client.reloadApp可以工作,我仍然会喜欢这一个,因为这个解决方案不会给用户一个闪烁的屏幕。哪个更方便用户 – ErikBrandsma 2014-11-05 12:13:45