Codex tools: Log in
This action is located inside of wp_signon. In contrast to the wp_login action, it is executed before the WordPress authentication process.
Located in /wp-includes/user.php.
You can use wp_authenticate to use a custom login mechanism before you involve WordPress.
add_action('wp_authenticate','check_custom_authentication');
function check_custom_authentication($username) {
global $wpdb;
if(!username_exists($username)) {
return;
}
$userinfo = get_userdatabylogin($username);
$property = $wpdb->prefix."capabilities";
$caps = $userinfo->$property;
foreach($caps as $role) {
if($role=='special_authenticator') {
wpExternalLoginProcess($username,$_POST['pwd']);
}
}
}