php-openid
php-openid copied to clipboard
improvements for examples
how is it possible to certificate your identity without have logged in? so in examples/server/lib/actions.php on line 41 we should replace with this code:
if ($request->idSelect()) {
// Perform IDP-driven identifier selection
if ($request->mode == 'checkid_immediate') {
$response =& $request->answer(false);
} else {
if (!getLoggedInUser()) {
return login_render();
}
return trust_render($request);
}
}
Moreover I don't understand why if you are logged in you have to provide your identity throught in trust.php so I replaced the function:
function trust_render($info)
{
$current_user = getLoggedInUser();
$lnk = link_render(idURL($current_user));
$trust_root = htmlspecialchars($info->trust_root);
$trust_url = buildURL('trust', true);
/*if ($info->idSelect()) {
$prompt = id_select_pat;
} else {
$prompt = sprintf(normal_pat, $lnk, $trust_root);
}*/
$prompt = sprintf(normal_pat, $lnk, $trust_root);
$form = sprintf(trust_form_pat, $trust_url, $prompt);
return page_render($form, $current_user, 'Trust This Site');
}
consequently in file common.php in the function doAuth I changed in this way;
if ($info->idSelect()) {
$req_url = idURL($user);
/*
if ($idpSelect) {
$req_url = idURL($idpSelect);
} else {
$trusted = false;
}*/
} else {
$req_url = $info->identity;
}
I hope to be helpful!