26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 1 of 16http://localhost:8000/?print-pdf#/
LESSONS LEARNT IMPLEMENTING A WORK‐LESSONS LEARNT IMPLEMENTING A WORK‐LIGHT-BASED ECOMMERCE MOBILE SOLUTIONLIGHT-BASED ECOMMERCE MOBILE SOLUTION
/ / Sean Bedford @bedfordsean [email protected]
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 2 of 16http://localhost:8000/?print-pdf#/
WHAT IS WORKLIGHT? - SERVER SIDEWHAT IS WORKLIGHT? - SERVER SIDE
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 3 of 16http://localhost:8000/?print-pdf#/
WHAT IS WORKLIGHT? - CLIENT SIDEWHAT IS WORKLIGHT? - CLIENT SIDE
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 4 of 16http://localhost:8000/?print-pdf#/
THE BIGGER PICTURETHE BIGGER PICTURE
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 5 of 16http://localhost:8000/?print-pdf#/
WHY IS IT GOOD?WHY IS IT GOOD?Out-of-box support for app analytics (Device, OS, codeversion)Direct update provides a powerful way to quickly patchissuesApp versioning scheme allows operational management ofmultiple deployed versionsSecurity model provides easy control of back end resourcesNot "just Cordova (PhoneGap)" - native APIs for iOS,Android, and devices running JavaME
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 6 of 16http://localhost:8000/?print-pdf#/
CORDOVA PRIMERCORDOVA PRIMERAPI layer between web container and native functionalityYou can write a new Cordova plugin with nativeimplementations on each platform you want to supportThis plugin can then be wrapped in to JavaScript to allow forcalling from a web container
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 7 of 16http://localhost:8000/?print-pdf#/
CLIENT SIDE CODECLIENT SIDE CODEMVC APPROACHMVC APPROACH
How do you store data?How do you display data?How do you handle the business rules?
Pick a framework that supports MVC such as jQuery Mobile,AngularJS, or Dojo. It will make your life MUCH easier :-)
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 8 of 16http://localhost:8000/?print-pdf#/
THINK OF THE USERTHINK OF THE USERThink about how the user is going to interact with your appConsider controls, text sizes, readability. Applerecommends >= 44px * 44px tappable area and 17pt+ fontsizeDesign, prototype, and test with actual end-usersDon't be afraid to scrap a design and start again
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 9 of 16http://localhost:8000/?print-pdf#/
COMMON UI PATTERNSCOMMON UI PATTERNS
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 10 of 16http://localhost:8000/?print-pdf#/
SERVER SIDE CODESERVER SIDE CODECONSISTENT ENDPOINT MANAGEMENTCONSISTENT ENDPOINT MANAGEMENT
Common problem: How to handle errors, timeouts, badresponses consistently?Solution: Provide a consistent client- and server-sideendpoint
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 11 of 16http://localhost:8000/?print-pdf#/
GO-LIVE CONSIDERATIONSGO-LIVE CONSIDERATIONSThink about end-end versioning - does your back endsupport multiple live versions?Think about security - validation in the front end only isnever enoughThink about how the application will load and servicefrequent requests (startup, browse, login...)Think about operational management (logging, reporting,information for support)
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 12 of 16http://localhost:8000/?print-pdf#/
BASIC WORKLIGHT USER AUTHENTICATIONBASIC WORKLIGHT USER AUTHENTICATIONA key feature of Worklight is it's security modelThis allows the securing of a back end call with a single lineof code (once it is set up)
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 13 of 16http://localhost:8000/?print-pdf#/
AUTHENTICATION FLOWAUTHENTICATION FLOW
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 14 of 16http://localhost:8000/?print-pdf#/
EXAMPLE - SET UPEXAMPLE - SET UPCreate a challenge handler in your code. This will need toissue a username/password, or some other authenticationtoeknSet up a realm and security test inauthenticationConfig.xml. In this security test, state youwant to use adapter functions to authenticate the user<customsecuritytest name="MySecurityTest"><test isinternaluserid="true" realm="MySecureRealm" step="1"></test></customsecuritytest> ... <realm loginmodule="StrongDummy" name="MySecureRealm"><classname>com.worklight.integration.auth.AdapterAuthenticator</classname><parameter name="login-function" value="AuthenticationAdapter.onAuthRequired"><parameter name="logout-function" value="AuthenticationAdapter.onLogout"></parameter></parameter></realm>
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 15 of 16http://localhost:8000/?print-pdf#/
EXAMPLE - SECURING A FUNCTIONEXAMPLE - SECURING A FUNCTIONIn your adapter's XML file, add a security test to a function<procedure name="myUnsecuredProcedure"></procedure><procedure name="mySecuredProcedure" securitytest="MySecurityTest"></procedure>
This will trigger the security test against the realm you'vedefined in authenticationConfig.xmlThis in turn will issue a challenge for "MySecureRealm" ifthere is no user logged in for that realmAt this point, your client code can handle the challenge, byproviding authentication details, tokens, or similarAfter authenticating, Worklight can re-issue the originalrequest and return a result from the back end service
26/03/2014 10:04Lessons Learnt implementing a Worklight-based eCommerce mobile solution
Page 16 of 16http://localhost:8000/?print-pdf#/
QUESTIONS?QUESTIONS?