AuthManager: do not rewrite PRIMARY_REQUIRED to REQUIRED
authorGergő Tisza <gtisza@wikimedia.org>
Thu, 4 Aug 2016 20:47:57 +0000 (20:47 +0000)
committerGergő Tisza <gtisza@wikimedia.org>
Wed, 17 Aug 2016 05:51:53 +0000 (05:51 +0000)
commitd4de10750fbb59a4580703fe928aac586187d46f
tree10dfcdbad5aa91ac8a6160d1dc534d8c95c82fbc
parentb8a41ea451aa22a5d34e882349992bddfc69f8ba
AuthManager: do not rewrite PRIMARY_REQUIRED to REQUIRED

AuthManager::getAuthenticationRequests() changes
AuthenticationRequest::$required from REQUIRED to PRIMARY_REQUIRED
if the request is from a primary; it made an exception when
all primary providers returned a given request. That exception is
not particularly useful (AuthenticationRequest::mergeFieldInfo()
used to rely on it to determine which fields are required, but
since I9d33bd2 that's not really needed), and knowing which request
is from a primary is useful for other means.

This changes required field semantics in a corner case: when a
primary provider returns two required requests, the previous
behavior was to assume that they are both required; the new one
is to treat them as alternatives (as if they were returned by
two different providers). So when all primary providers return
request X, and one of them returns Y in addition, the fields of X
will not be marked required, while previously that would have been
the case.

Instead of overcomplicating the interface for something that is
unlikely to come up in any real use case, add a new requirement
to PrimaryAuthenticationProvider that it should not return
multiple required requests.

Bug: T141471
Change-Id: I1c1f44d4d6b66f77c876e3459fb97f03483db744
RELEASE-NOTES-1.28
includes/auth/AuthManager.php
includes/auth/AuthenticationRequest.php
includes/auth/PrimaryAuthenticationProvider.php
tests/phpunit/includes/auth/AuthManagerTest.php