Embedthis GoAhead 3.3.1
Home > Programming Guide > Creating Password Store Verifiers

# Quick Nav

# See Also

# 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;
    }

© Embedthis Software LLC, 2003-2014. All rights reserved. Embedthis and Embedthis GoAhead are trademarks of Embedthis Software LLC.