IazertyuiopI
IazertyuiopI

Reputation: 488

Protecting applications IBM worklight

I am new to IBM worklight; I have been trying to implement app-level form authentication for an hybrid android app without success. What I did: add <android securityTest="try" version="1.0"> to my application-descriptor.xml, where try is defined as follows:

<mobileSecurityTest name="try">
            <testDeviceId provisioningType="none" />
            <testUser realm="myMobileLoginForm" />
 </mobileSecurityTest>

<realm loginModule="requireLogin" name="myMobileLoginForm">
            <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
            <parameter name="login-page" value="login.html" />
</realm>

From what I understood from the docs, this should redirect users to the sample login.html on startup where I can manage the client-side user actions with a ChallengeHandler. However the securityTest="try" attribute does nothing at all. Please tell me what if i missed something huge, which seems to be the case...

EDIT: I get the login.html as server response now, guess I should display it with javascript

FINAL EDIT : In case someone encounters similar issues, here is what i did in the challenge handler:

login_clientside.isCustomResponse = function(response) { document.body.innerHTML = response.responseText; //alert('test'); return false; };

Of course this is without the UI part to get a nice looking login page-- and the security part.

Upvotes: 2

Views: 110

Answers (1)

Joshua Alger
Joshua Alger

Reputation: 2132

Worklight provides a tutorial presentation along with an accompanying sample that you can run in test that does Form-Based Authentication.

Form-Based Authentication Presentation

http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/08_02_Form_based_authentication.pdf

Form-Based Authentication Sample

http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v610/FormBasedAuthenticationProject.zip

Since you stated you are new to Worklight I would suggest reading through this presentation and then attempt running the sample inside of Worklight Studio. Once you understand the concepts and have the sample running correctly you should have no problem incorporating these techniques into your project. Let me know if you have any specific questions.

Upvotes: 2

Related Questions