How to force php application to require smart card authentication

I can force the browser to force authentication with a smart card, such as an ID card, when the php file is protected by SSLVerifyClient in apache conf.

Now I need to display index.php, usually without smart card authentication, and sometimes the same page needs to be authenticated by the user.

doStuff();
if ($needed==1)
  authenticateUser();
doMoreStuff();

What is required for User () authentication so that the call invokes the browser to request the smart card PIN?

+5
source share
1 answer

. authenticateUser(); , . PHP , PHP .

:

if(authenticationNeeded)
{
   // redirect to a page that requires authentication that does what index was supposed to do.
   redirect('index_ssl.php');
}

.htaccess, SSLVerifyClient require /.
, - ( Apache) , /, SSLVerifyClient require.

, , . /, . PHP, , , .

+4

All Articles