16 Commits (928e19e63720947dc4189d587f6b20a47ac64a00)

Author SHA1 Message Date
Jordi Boggiano 928e19e637
Merge branch '2.2' into main 2 years ago
Stephan Vock d40c3a89c0
GitLab: add warning in case GitLab authentication is misconfigured 2 years ago
Stephan Vock 3b4a3d63bf
GitLab: prevent invalid loop during composer install with invalid credentials 2 years ago
Jordi Boggiano 6a466a120a
Enable strict types on all files 2 years ago
Jordi Boggiano 7abc8da7d3
Add more types 2 years ago
Jordi Boggiano 6da38f83a0
Add parameter types to all the things 2 years ago
Alexander Schranz e9b60580f5
Add return types to tests (#10) 2 years ago
Jordi Boggiano abdc6893a6
Add void types where no return statement is present 2 years ago
Jordi Boggiano 6ed3aeb343
Remove setExpectedException wrapper 2 years ago
Jordi Boggiano 2a771dfb2d
Update PHPUnit to 8.5 2 years ago
Martin Herndl 2992e8651a
Add types to `Util` tests (#10228) 3 years ago
Jordi Boggiano b7d770659b
CS fixes 4 years ago
Andrés De la Cruz 480a6439fd
Fix phpstan phpdocs issues (#9478) 4 years ago
Jordi Boggiano 1593b67230
Fix warnings on higher phpunit versions 4 years ago
Ayesh Karunaratne 931a1ff1f8
AuthHelper: Allow fall-through GitLab-specific HTTP headers for auth
Previously, `AuthHelper` consumed the authentication credentials for GitLab domains and added access tokens as GitLab-specific headers.
[Composer repositories now supported in GitLab](https://php.watch/articles/composer-gitlab-repositories) require standard Authorization headers with a personal access to function, which failed to work due to out GitLab-specific headers.

With this commit, AuthHelper checks if the password is an access token, and falls through to HTTP basic authentication even if the domain name is a GitLab domain name.
4 years ago
Michael Chekin c23670c3ec
Add Util\AuthHelper unit test coverage (#8863)
* Add AuthHelper::addAuthenticationHeader() test on missing authentication credentials.

* Add AuthHelper::addAuthenticationHeader() test on bearer password.

* Add AuthHelper::addAuthenticationHeader() test on Github token.

* Add AuthHelper::addAuthenticationHeader() test on Gitlab Oauth token.

* Add $authenticationDisplayMessage write expectation to AuthHelper::addAuthenticationHeader() tests.

* Add AuthHelper::addAuthenticationHeader() test on Gitlab private token.

* Add AuthHelper::addAuthenticationHeader() test on Bitbucket Oauth token.

* Add AuthHelper::addAuthenticationHeader() test on Bitbucket public urls.

* Add AuthHelper::addAuthenticationHeader() test on Basic Http Authentication.

* Add AuthHelper::isPublicBitBucketDownload() tests.

* Rename AuthHelperTest $credentials variable to $auth.

* Add AuthHelper::storeAuth() test for auto-store option.

* Add AuthHelper::storeAuth() test for user prompt and y(es) answer.

* Add AuthHelper::storeAuth() test for user prompt and n(o) answer.

* Add AuthHelper::storeAuth() test for user prompt with invalid answer.

* Add AuthHelper::promptAuthIfNeeded() test for Github authentication failure.

- add GitHub hard dependency mock (new GitHub(...) mock)

* Run AuthHelper::promptAuthIfNeeded() tests only with PHP > 5.3

* Run AuthHelper::promptAuthIfNeeded() tests only with PHP >= 5.4

* Run AuthHelper::promptAuthIfNeeded() tests only with PHP 5.4

* Exclude PHPStan analyses of '../tests/Composer/Test/Util/Mocks/*'

* Exclude AuthHelper::promptAuthIfNeeded() tests from current pull request.

* Extract repetitive AuthHelperTest authentication expectation into a method.
4 years ago