Write your Authorization script/program to any language you prefer.
It must accept two arguments, provided from the Dancer2::Plugin::WebService

    username packed as hex string   (to avoid shell attacks)
    password packed as hex string   (to avoid shell attacks)

	e.g.

    SomeScript 6a6f65 536f6d6550617373776f7264

As a result, the script must print at the standard output the two lines

    1st line : 0 if the login is succesfull or a message of the login failure description
    2rd line : a comma delimitted list of the groups the user is member e.g.

	for successful login

		0
		admins,ftp,ldapadmin

	for failed login

		server is on maintenance
		""

If the user do not belong to any of the   config.yml  defined groups
then the login will fail even if the user/pass are correct

	Groups : [ group1 , group2 ... ]

For your tests, you can use any of the commands to convert

     text to hex

		echo -n joe | xxd -ps
		echo -n joe | od -A n -t x1 | sed 's/ //g'
		perl -E 'say unpack "H*", shift' joe

	hex to text

		echo -n 6a6f65 | xxd -r -ps
		perl -E 'say pack "H*", shift' 6a6f65

If root privileges are needed, e.g. for the "native Linux" authentication Command,
set at the config.yml

	...
	Use sudo : true

and add the user running the WebService to sudoers e.g.

  vi /etc/sudoers.d/WebService

    dancer ALL=(ALL) NOPASSWD: /usr/local/share/perl5/Dancer2/Plugin/AuthScripts/LinuxNative.pl	


Thats all; now you are ready to write some auth scripts.

George Bouras
