我最近发现存储在AdapterSecurityContext中的mobilefirst 8服务器数据存在问题。我们使用方法getClientRegistrationData在自定义安全检查下将安全用户数据存储在AdapterSecurityContext中。 它在Mobilefirst DevKit服务器上正常工作
ClientData clientData = adapterSecurityCheck.getClientRegistrationData();
clientData.getPublicAttributes().put(key, "hello");
adapterSecurityCheck.storeClientRegistrationData(clientData);
但是当我在Liberty服务器上运行相同的适配器或者我们安装它的ND服务器时,它给了我以下错误
com.ibm.mfp.server.core.sha red.MFPRESTException:409; headers = [MFP-Conflict =并发失败];体= {}
at com.ibm.mfp.server.registration.internal.RegistrationServiceImpl.stor eClient(RegistrationServiceImpl.java:235)
at sun.reflect.GeneratedMethodAccessor965.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:157)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP roceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv oke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:207)
at com.sun.proxy.$Proxy219.storeClient(Unknown Source)
at com.ibm.mfp.server.security.internal.services.AdapterSecurityContextI mpl.storeClientRegistrationData(AdapterSecurityContextImpl.java:91)
at com.pscu.ServiceAdapterResource.setSecureData(ServiceAdapterResource. java:2321)
at com.pscu.ServiceAdapterResource.setAllCardsInToSecuredStore(ServiceAd apterResource.java:2332)
at com.pscu.ServiceAdapterResource.getPostLoginData(ServiceAdapterResour ce.java:250)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:88)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(Abst ractInvoker.java:181)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker .java:97)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:200)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInv okerInterceptor.java:59)
答案 0 :(得分:0)
请参阅https://www.ibm.com/support/knowledgecenter/en/SSHS8R_8.0.0/com.ibm.worklight.apiref.doc/html/refjava-mfp-server/html/com/ibm/mfp/server/security/external/resource/AdapterSecurityContext.html。必须通过AdapterSecurityContext.getClientRegistrationData(),AdapterSecurityContext.getClientRegistrationData(String)或AdapterSecurityContext.findClientRegistrationData(ClientSearchCriteria)获取ClientData实例。 如果在通过此请求获取注册数据后,并发请求会修改注册数据,则此方法会抛出一个运行时异常,该异常会自动报告给客户端,如HTTP状态409(冲突)。