How To: New Authentication Stuff

I was just going through implementing the new 5.2.x enhanced security stuff - and thought I’d share a few thoughts:

*READ the wiki instructions (and download the excellent samples) http://wiki.servoy.com/display/public/DOCS/Upgrade+existing+implementations+to+Servoy+5.2’s+Enhanced+Security

  • You CANNOT base form(s) in your Login solution on a table - the dataSource MUST be set to none

*Put any code that need to access table data into a global method in your Authenticator solution (ONLY)

*Put any code that needs to access plug-ins into a global method in your Authenticator solution (e.g. mail plug-in for “Forgot my password” type functionality, etc.)

*Your Authenticator solution CANNOT set global fields - but your Login solution CAN (useful for setting current user ID, department or whatever)

*You CANNOT use application.showFormInDialog() in your code (neither in the Authenticator nor your Login solution)

*From your Login solution - trigger the global methods in your Authenticator solution using this syntax: ```
myvar = security.authenticate(“nameOfAuthenticatorSolution”,“nameOfGlobalMethod”,[array of arguments])


*Have your global method(s) in your Authenticator solution return an array of data that you can use in your login solution 

function resendUserInfo(event,address) {
// get the user based on their email

var fs = databaseManager.getFoundSet("myConnection","myTable");

if(!fs) {
	application.output("No 'myTable' foundset [error in authenticator]")
	return false;
}

fs.find();
fs.email_address = address;
var found = fs.search();

if(found == 0) {
	application.output("EMAIL NOT FOUND [authenticator]")
	return null;
}

var myArray = [];
myArray[0] = databaseManager.getFoundSetDataProviderAsArray(fs, "login_name");
myArray[1] = databaseManager.getFoundSetDataProviderAsArray(fs, "login_pw");
myArray[2] = databaseManager.getFoundSetDataProviderAsArray(fs, "user_id");

return myArray;

}


I hope this helps save you some time in your development efforts!