DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING.
THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.

Enter additional information related to this 'class' inside the {div} macro with 'id=description'



Return Types
 



Method Summary
Object
authenticate(authenticator_solution, method, credentials)
Authenticate the given credentials against the mobile service solution.
String
getUserName()
returns the current logged in username of that is used when doing a sync.
void
logout()
Clears the current credentials that the user specified when doing a sync.



Method Details

authenticate

Object
authenticate
(authenticator_solution, method, credentials)
Authenticate the given credentials against the mobile service solution. First two parameters are not used in mobile solution, just the credentials.
It will set the credentials and then do a sync call to the server.

Parameters

{String} authenticator_solution - authenticator solution installed on the Servoy Server, null for servoy built-in authentication
{String} method - authenticator method, null for servoy built-in authentication
{Object[]} credentials - array whose elements are passed as arguments to the authenticator method, in case of servoy built-in authentication this should be [username, password]

Returns

Object - authentication result from authenticator solution or boolean in case of servoy built-in authentication

Sample

// method will return null in mobile client, the same flow as for default login page will happen after calling this method
security.authenticate(null, null, ['myusername', 'mypassword']);
 

getUserName

String
getUserName
()
returns the current logged in username of that is used when doing a sync.

Returns

String - the user name

Sample

var username = security.getUserName();
if (username != null) {
  // user is logged in
}
 

logout

void
logout
()
Clears the current credentials that the user specified when doing a sync. When the next sync happens the login form will be shown.

Returns

void

Sample

security.logout();
plugins.mobile.sync();