Here's some code for you to chew on until I get a more complete
example finished. It should be enough to get you started, along with
the API docs.
Create your "login delegate class":
class admin_LoginDelegate
{
function login($username, $password, $passIsToken)
{
try {
$provider = ProviderPeer::retrieveByUsername($username);
if (!$provider) return NULL;
$cmpPass = ($passIsToken ? $password : md5($password));
if ($cmpPass == $provider->getPasswordMd5())
{
$authInfo = new WFAuthorizationInfo;
if ($provider->getUsername() == 'mysuperusername')
{
$authInfo->setIsSuperUser(true);
}
$authInfo->setUserid($provider->getProviderId());
return $authInfo;
}
} catch (Exception $e) {
throw($e);
}
return NULL;
}
}
And then, in MyWebApplicationDelegate::initialize(), put:
// set up authorization delegates
$ac = WFAuthorizationManager::sharedAuthorizationManager();
$ac->setDelegate(new admin_LoginDelegate);
That's it.
Of course, you'll have to adjust the logic code in the login delegate
to access your own data structures, but as you can see, it's quite
straightforward.
Alan