[Authentication] Solution to prompting and async operations

Stef Walter stef-list at memberwebs.com
Sun Nov 8 07:38:22 PST 2009


Stef Walter wrote:
> I've finally come up with a solution the whole set of problems to do
> with prompting and long running or asynchronous operations. I believe
> this covers every requirement. This wasn't an easy task.

I've been implementing this, and it's generally been going well. One
problem though:

>  * Operations that may require prompting can optionally return
>    the object path to a 'prompt object'.

In this scheme described earlier, we optionally return an object path.
Some operations (even Unlock) may not always return a prompt object when
they don't need to prompt. To be clear the Unlock method's signature is:


Unlock(IN Array<ObjectPath> objects,
       OUT Array<ObjectPath> unlocked,
       OUT ObjectPath prompt)

The prompt out value is returned only when a prompt is necessary to
unlock some or all of the items. This is just an example, there are
several methods in the API with this general concept.

So, it turns out that DBus has no concept of nullable types. In addition
it has no concept of an 'empty' object path. This makes returning an
optional prompt object path hard. If we return an empty string the
session bus kicks our app from the bus.

Here are three possible options:

 * The closest thing we can get to an empty path is the '/' path. We
   could decide to make that a special path that denotes 'no prompt'.

 * We could return a third boolean value, that says whether the
   prompt path is valid or not.

 * We could return an array of object paths, representing multiple
   prompts. This array would be empty if none were necessary.

I prefer the first option. The last option makes implementing a client
difficult, you have to track each prompt and show them in turn before
you can be sure the operation completed.

What do you think?

Cheers,

Stef



More information about the Authentication mailing list