@inlineCallbacks<EOL>def authenticate(realm, authid, details):
global _start<EOL>global _waiting<EOL>import json<EOL>ticket = json.loads(details['<STR_LIT>']<EOL>)<EOL>if '<STR_LIT>' not in ticket and '<STR_LIT:version>' not in ticket:<EOL><INDENT>raise ApplicationError(<EOL>'<STR_LIT>')<EOL><DEDENT>application_name = ticket['<STR_LIT>']<EOL>version = ticket['<STR_LIT:version>']<EOL>required_components = ticket[<EOL>'<STR_LIT>'] if '<STR_LIT>' in ticket else {}<EOL>if not _try_to_start_app(application_name, version, required_components):<EOL><INDENT>ready_defered = defer.Deferred()<EOL>ready_defered.addCallback(defer_try_start_app,<EOL>application_name=application_name,<EOL>version=version,<EOL>required_components=required_components)<EOL>_waiting[application_name]['<STR_LIT>'] = ready_defered<EOL>yield ready_defered<EOL><DEDENT>print("<STR_LIT>", _start)<EOL>print("<STR_LIT>", _waiting)<EOL>for k in _start:<EOL><INDENT>if k in _waiting:<EOL><INDENT>_waiting = remove_element(_waiting, k)<EOL><DEDENT><DEDENT>returnValue("<STR_LIT>")<EOL>
application_name : name of your application
version : version of your application
required_components dictionary of components required for you application
and their version required

    {
       "component" : "1.1",
       "component2" : "0.1",
       ...
    }

 when all the different component required has been register your component will
 be allow to authenticate with a role build only for your application with
 only the right right for it to works