just found a way to solve it :-)
-- I do not know, if it is the best way to implement and to place it...
The docu helped my
Am Samstag, 28. November 2015 10:39:25 UTC+1 schrieb Rumkuchen:
The docu helped my
created a file "/vendor/cakephp/src/Auth/Basic2Authenticate.php"
(I hope, it does not disappear after update via composer)
<?php
namespace Cake\Auth;
use Cake\Network\Exception\UnauthorizedException;
use Cake\Network\Request;
use Cake\Network\Response;
class Basic2Authenticate extends BasicAuthenticate
{
public function authenticate(Request $request, Response $response)
{
return $this->getUser($request);
}
public function getUser(Request $request)
{
$username = $request->env('PHP_AUTH_USER');
$pass = $request->env('PHP_AUTH_PW');
if (!is_string($username) || $username === '' || !is_string($pass) || $pass === '') {
return false;
}
if ($username === 'foo' && $pass === "bar") {
return ['User' => $username, 'Password' => $pass];
}
return false;
}
}
Am Samstag, 28. November 2015 10:39:25 UTC+1 schrieb Rumkuchen:
I want to use Basic Authentication without a Model - so I want to verify the credentials in a controller....Is that possible? I know how to do it with Form-Authentication but not with Basic Authentication.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment