Adapter-based authentication is the simplest form of authentication provided in Worklight. It uses the adapter
procedure/function to validate and authenticate the users and create their sessions. Plus, it provides all the features of the Worklight authentication framework.
Please use the following simple steps to implement adapter-based authentication:
Create a new Worklight project with the name
ABADemo
; for the application, use the namemyAdapterBasedAuthentication
.Add an adapter and give it a name:
myAuthAdapter
. Paste the following sample function code into theadapter.js
file:function onAuthRequired(headers, errorMessage){ errorMessage = errorMessage ? errorMessage : null; return { authRequired: true, errorMessage: errorMessage }; } function submitUserAuthentication(username, password){ if (username==="adapter" && password === "adapter"){ var userIdentity = { userId: username, displayName: username, ...