保护 Java 适配器

Protecting Java Adapter

我们正在制作 Java 适配器,并希望通过 CustomAuthenticator 和 CustomLoginModule 进行保护。

我们从示例项目开始: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/authentication-security/custom-authenticator-login-module/custom-authenticator-login-module-hybrid-applications/

然后我们添加了简单的 Java 适配器。

然后,在客户端代码中,我们修改了main.js中的getSecretData()函数,使其调用/adapters/JavaAdapter/users而不是原来的/adapters/DummyAdapter/getSecretData

最后,我们在适配器的 hello() 函数中添加了 @OAuthSecurity(scope="CustomAuthenticatorRealm") 注释。

但是单击 "call protected adapter proc" 按钮成功 returns 来自 hello() 的数据未经身份验证

我们应该怎么做才能使身份验证适用于 Java 适配器调用?

这意味着从您使用 javascript 适配器测试时起,您的客户端(浏览器?模拟器?设备?)仍然具有与您的服务器的有效会话 ID。

我试过你的场景,也遇到过同样的事情。但是,我能够通过清除 cookie 获得正确的行为(对于 ios 模拟器,通过重置模拟器)。

在您注销之前,这是预期的行为。 注销功能无法与 7.0 中的 Java 适配器正常工作。