Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Zf mvc auth can not identifier request type. Collection or Entity #144

Open
newdevonair opened this issue Jul 26, 2018 · 3 comments
Open

Comments

@newdevonair
Copy link

protected function getIdentifier($identifierName, $routeMatch, $request)

This method can not identifier request type for authorization check.
I have REST service

/path/to/url[/:identifier_name]

Allowed methods is
COLLECTION -> GET
ENTIITY-> PUT
for authorization I have this configs

'collection' => [
	'GET' => true,
	'POST' => false,
	'PUT' => false,
	'PATCH' => false,
	'DELETE' => false,
],
'entity' => [
	'GET' => false,
	'POST' => false,
	'PUT' => true,
	'PATCH' => false,
	'DELETE' => false,
],

but when I'm sending request like this

/path/to/url?identifier_name=some_value

zf auth think that this is ENTITY-> GET.
because of on line 137 you are checking also if identifier exist in query parameters

@newdevonair
Copy link
Author

@weierophinney what you think about it.
is it ok?

@weierophinney
Copy link
Member

It's not interpreting the request as a GET request; it's instead matching a query string argument (which can occur with ANY URI, not just those sent via GET).

I'm not sure why we check for the identifier in the query string arguments, to be honest; we likely shouldn't. However, to change that at this time would break backwards compatibility.

Can you answer a couple questions for me, please, so we can better evaluate your concerns?

  • Why are you sending the identifier using a query string argument in the first place?
  • What problems are you observing due to the current behavior, exactly?

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-mvc-auth; a new issue has been opened at laminas-api-tools/api-tools-mvc-auth#1.

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

No branches or pull requests

2 participants