Search code examples
phpcakephphttp-authentication

Reading loginame after http authentification


I seem not to be able to wrap my head around this.. How can I read out the loginname that was used for http authentification using PHP, more specifically, cakePHP? I am using the Security Component of cakePHP.


Solution

  • Normally:

    $_SERVER['PHP_AUTH_USER'];

    http://php.net/manual/en/features.http-auth.php

    In Cake try this in the controller maybe:

    $this->data['User']['username']

    http://book.cakephp.org/1.3/en/view/1261/login