Open weierophinney opened 4 years ago
I believe you are right, and this is a duplicate of https://github.com/zfcampus/zf-mvc-auth/issues/97
Originally posted by @PowerKiKi at https://github.com/zfcampus/zf-apigility-skeleton/issues/111#issuecomment-142209289
You're right. My fix is even worse. It prevent challenge of client when needed...
...
'zf-mvc-auth' => [
'authentication' =>
'adapters' => [
'http' => [
// HTTP auth adapter configuration
],
'whatever' => [
// Whatever auth adapter configuration
],
],
'map' => [
'API/VERSION1' => 'basic',
'API/VERSION2 => 'whatevertype'
]
]
]
...
Now, let imagine the following scenario: A client request the following URI /host.tld/API/VERSION1 (here, the matching authentication type is basic
). No Authorization
header is sent by the client.
Then, the following will occurs in the default authentication listener:
basic
)At this point, if the mvc http adapter don't find the Authorization
header, it will simply return a GuestIdentity
. So, later on, the authorization listener will simply set a 403 status code if GuestIdentity
is not allowed to access the resource.
I'll investigate and try to provide a patch.
Originally posted by @nuxwin at https://github.com/zfcampus/zf-apigility-skeleton/issues/111#issuecomment-166561005
Hello If a non-authenticated user sends request to a page that needs authorization, then he will get 403 status (Forbidden). I think this bahavior is incorrect, because he should get 401 status (Unauthorized). It was happened because of this fix https://github.com/zfcampus/zf-mvc-auth/issues/92 Here is this fix:
I think that this fix is incorrect. I think we should check the authentication only if this method requires the authorization and we shouldn't check the Authorization header here.
Originally posted by @Redigast13 at https://github.com/zfcampus/zf-apigility-skeleton/issues/111