Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error : Public function getAuthorizationService #132

Closed
saillmone opened this issue Jul 14, 2021 · 2 comments
Closed

Fatal error : Public function getAuthorizationService #132

saillmone opened this issue Jul 14, 2021 · 2 comments

Comments

@saillmone
Copy link

Hi,

I am using Authentification and Authorization plugins (Cakephp 4.1). I followed your instructions here and here.

I have a problem with the function getAuthorizationService in Application class :

Fatal error: Declaration of App\Application::getAuthorizationService(Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response) must be compatible with Authorization\AuthorizationServiceProviderInterface::getAuthorizationService(Psr\Http\Message\ServerRequestInterface $request): Authorization\AuthorizationServiceInterface

    public function getAuthorizationService(ServerRequestInterface $request, ResponseInterface $response) {
        $map = [
            ServerRequest::class => new RequestPolicy(),
        ];
        $resolver = new MapResolver($map);

        return new AuthorizationService($resolver);
    }

Can you help me please ?

@saillmone
Copy link
Author

With this:

    public function getAuthorizationService(ServerRequestInterface $request): AuthorizationServiceInterface
    {
        $map = [
            ServerRequest::class => new RequestPolicy(),
        ];
        $resolver = new MapResolver($map);

        return new AuthorizationService($resolver);
    }

Return:

Error : Authorization\Exception\ForbiddenException

@dereuromark
Copy link
Owner

Did you find out what the issue is?
If there is something wrong, feel free to PR also a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants