Creating Password Store Verifiers
You can use a custom password store with GoAhead by defining a password verifier routine. and then establishing it via the websSetPasswordStoreVerify API.
Here is a sample verify routine that you can use as a starter:
static bool verifyPassword(Webs *wp)
{
char *password, *roles;
/*
If using Digest auth, compare the digest of the password
*/
password = (wp->digest) ? wp->digest : wp->user->password;
if (!CHECK_PASSWORD(wp->username, password, &roles)) {
return 0;
}
/*
Create the user inside GoAhead and set the user roles/abilities
*/
if ((wp->user = websLookupUser(wp->username)) == 0) {
if ((wp->user = websAddUser(wp->username, 0, roles)) == 0) {
return 0;
}
websSetUserRoles(wp->username, roles);
}
return 1;
}