2

I recently found an issue with mobilefirst 8 server data storing in AdapterSecurityContext. We are storing secured user data in AdapterSecurityContext using method getClientRegistrationData under a custom security check. It's working fine in Mobilefirst DevKit server

ClientData clientData = adapterSecurityCheck.getClientRegistrationData();

clientData.getPublicAttributes().put(key, "hello");
adapterSecurityCheck.storeClientRegistrationData(clientData);

But when I run same adapter on Liberty server or Was ND server on which we installed it's giving me below error

com.ibm.mfp.server.core.sha red.MFPRESTException: 409; headers=[ MFP-Conflict=Concurrency failure]; body={}

    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)
parth.hirpara
  • 542
  • 3
  • 19
  • Are you storing data using getClientRegistrationData() or storeClientRegistrationData() ? – manjunath kallannavar Mar 26 '18 at 07:06
  • Using storeClientRegistrationData. I have updated the question with the code snippet. Thank you. – parth.hirpara Mar 26 '18 at 07:11
  • This looks like there is a concurrency issue when performing storeClientRegistrationData() immediately after getClientRegistrationData() being performed .Can you try using storeClientRegistrationData() call only if client id is not null ? something like validations before calling storeClientRegistrationData() to make sure getClientRegistrationData() call completed before calling storeClientRegistrationData() . – manjunath kallannavar Mar 26 '18 at 08:08
  • getClientRegistrationData() is a sync method right? It's returning all the stored data as well. But when I am trying to modify using storeClientRegistrationData it's giving me error. – parth.hirpara Mar 26 '18 at 11:30
  • storeClientRegistrationData is throwing this exception. MFP database is oracle. – parth.hirpara Mar 26 '18 at 11:52
  • did u find any solution for this issue? @parth.hirpara – Swathi Nov 19 '20 at 05:47

1 Answers1

0

Please refer 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 . The ClientData instance must be obtained via AdapterSecurityContext.getClientRegistrationData(), AdapterSecurityContext.getClientRegistrationData(String), or AdapterSecurityContext.findClientRegistrationData(ClientSearchCriteria). If the registration data has been modified by a concurrent request after it was obtained by this request, this method throws a runtime exception which is automatically reported to the client as HTTP status 409 (Conflict).