0
votes

I'm developing an hybrid application and I'm implementing the push notification procedure provided in the sample code of the MobileFirst Platform "Getting Started" page for an Android device. As it is said in the tutorial, the device and user subscription to the push notification service can only take place after authentication. When using the following security test in the authenticationConfig.xml file it works fine:

Case 1:

<securityTests>
    <mobileSecurityTest name="PushApplication-strong-mobile-securityTest">
        <testUser realm="PushAppRealm"/>
        <testDeviceId provisioningType="none"/>
    </mobileSecurityTest>
</securityTests>

<realms>
    <realm loginModule="PushAppLoginModule" name="PushAppRealm">
          <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
    </realm>
</realms>

<loginModules>
    <loginModule name="PushAppLoginModule">
        <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
    </loginModule>
</loginModules>

However the application already was using a SingleStepAuthRealm for authenticating so when using the following security test in the authenticationConfig.xml file we are facing an issue:

<securityTests>
    <mobileSecurityTest name="PushApplication-strong-mobile-securityTest">
            <testUser realm="SingleStepAuthRealm"/>
            <testDeviceId provisioningType="none"/>
    </mobileSecurityTest>
</securityTests>
<realms>
    <realm loginModule="AuthLoginModule" name="SingleStepAuthRealm">
            <className>com.worklight.integration.auth.AdapterAuthenticator</className>
            <parameter name="login-function" value="SingleStepAuthAdapter.onAuthRequired"/>
            <parameter name="logout-function" value="SingleStepAuthAdapter.onLogout"/>
    </realm>
</realms>
<loginModules>
    <loginModule name="AuthLoginModule">
            <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
   </loginModule>
</loginModules>

In this case, the subscription is done correctly. We can see in the server that the user and the device is subscribed. Even, when we invoke the submitNotification(userId, notificationText) in the PushAdapter the call to WL.Server.notifyAllDevices(userSubscription, notification) is completed successfully and we are obtaining as a result that the Notification was sent to user. Also if we invoke the WL.Server.getUserNotificationSubscription and the getDeviceSubscriptions() methods the correct information is received abut the subscribed user and the device.

The problem that we are facing is that the subscribed device never receives the push notification. The message is never sent to the push notification mediator although no error is occurring.

Does it make a difference the security test used in the authenticationConfig.xml for authenticating the user before the push notifications?

Thanks very much in advance

1
Did you update the challenge-handler to use the SingleStepAuthRealm? - Shmulik Bardosh
We didn't update our SingleStepAuthRealm handler and is different from the handler used in the sample one. Also we had to delete the line <android securityTest="PushApplication-strong-mobile-securityTest" version="1.0"> from the application-desciptor.xml because that line forces the handler to be called once started the app and we wanted our handler to be called afterwards, with the SingleStepAuthRealm, once we have submitted our credentials. ¿Would that affect to the reception of push notifications? Thank you very much and sorry for the delay - Irene Marquet
Finally I added again the security test from the environment node <android securityTest="PushApplication-strong-mobile-securityTest" version="1.0"> and it work fine the reception of push notifications. The realm used does not make a difference in the reception for push notifications. - Irene Marquet

1 Answers

0
votes

Finally I added again the security test from the environment node and it work fine the reception of push notifications. The realm used does not make a difference in the reception for push notifications.