update
This commit is contained in:
34
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/.editorconfig
vendored
Normal file
34
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/.editorconfig
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
# https://github.com/php/php-src/blob/master/.editorconfig
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
tab_width = 4
|
||||
|
||||
[{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
[*.{dtd,html,inc,php,phpt,rng,wsdl,xml,xsd,xsl}]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
||||
[*.{ac,m4,sh,yml}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[*.md]
|
||||
indent_style = space
|
||||
max_line_length = 80
|
||||
|
||||
[COMMIT_EDITMSG]
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
max_line_length = 80
|
||||
|
||||
[*.patch]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -0,0 +1,86 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: '1.99.99'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2
|
||||
- uses: ramsey/composer-install@v3
|
||||
- name: 'Lint the PHP source code'
|
||||
run: ./vendor/bin/parallel-lint src test
|
||||
|
||||
coding-standards:
|
||||
name: Coding Standards
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.4'
|
||||
coverage: none
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2
|
||||
- uses: ramsey/composer-install@v3
|
||||
- name: Check coding standards
|
||||
run: ./vendor/bin/phpcs src --standard=psr2 -sp --colors
|
||||
|
||||
unit-tests:
|
||||
name: Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: ${{ matrix.experimental }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php-version:
|
||||
- '5.6'
|
||||
- '7.0'
|
||||
- '7.1'
|
||||
- '7.2'
|
||||
- '7.3'
|
||||
- '7.4'
|
||||
- '8.0'
|
||||
- '8.1'
|
||||
- '8.2'
|
||||
- '8.4'
|
||||
dependencies:
|
||||
- lowest
|
||||
- highest
|
||||
experimental:
|
||||
- false
|
||||
include:
|
||||
- php-version: '8.3'
|
||||
experimental: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '${{ matrix.php-version }}'
|
||||
coverage: pcov
|
||||
ini-values: memory_limit=-1
|
||||
tools: composer:v2
|
||||
- name: Prepare for tests
|
||||
run: mkdir -p build/logs
|
||||
- uses: ramsey/composer-install@v3
|
||||
with:
|
||||
dependency-versions: '${{ matrix.dependencies }}'
|
||||
composer-options: '${{ matrix.composer-options }}'
|
||||
- name: Run unit tests
|
||||
run: ./vendor/bin/phpunit --colors=always --coverage-clover build/logs/clover.xml
|
||||
- name: Publish coverage report to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
7
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/.gitignore
vendored
Normal file
7
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/build
|
||||
/vendor
|
||||
/.idea
|
||||
composer.phar
|
||||
composer.lock
|
||||
.DS_Store
|
||||
.phpunit.result.cache
|
||||
35
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/.scrutinizer.yml
vendored
Normal file
35
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/.scrutinizer.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
filter:
|
||||
excluded_paths: [test/*]
|
||||
checks:
|
||||
php:
|
||||
code_rating: true
|
||||
remove_extra_empty_lines: true
|
||||
remove_php_closing_tag: true
|
||||
remove_trailing_whitespace: true
|
||||
fix_use_statements:
|
||||
remove_unused: true
|
||||
preserve_multiple: false
|
||||
preserve_blanklines: true
|
||||
order_alphabetically: true
|
||||
fix_php_opening_tag: true
|
||||
fix_linefeed: true
|
||||
fix_line_ending: true
|
||||
fix_identation_4spaces: true
|
||||
fix_doc_comments: true
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 600
|
||||
runs: 1
|
||||
php_analyzer: true
|
||||
php_code_coverage: false
|
||||
php_code_sniffer:
|
||||
config:
|
||||
standard: PSR2
|
||||
filter:
|
||||
paths: ['src']
|
||||
php_loc:
|
||||
enabled: true
|
||||
excluded_dirs: [vendor, test]
|
||||
php_cpd:
|
||||
enabled: true
|
||||
excluded_dirs: [vendor, test]
|
||||
135
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/CHANGELOG.md
vendored
Normal file
135
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
# Changelog
|
||||
All Notable changes to `oauth2-apple` will be documented in this file
|
||||
|
||||
## 0.4.0 - 202X-XX-XX
|
||||
|
||||
### Added
|
||||
- Nothing
|
||||
|
||||
### Deprecated
|
||||
- Nothing
|
||||
|
||||
### Fixed
|
||||
- Nothing
|
||||
|
||||
### Removed
|
||||
- Nothing
|
||||
|
||||
### Security
|
||||
- Nothing
|
||||
|
||||
## 0.3.0 - 2024-05-18
|
||||
|
||||
### Added
|
||||
- Allow lcobucci/jwt ^5.0 [#44](https://github.com/patrickbussmann/oauth2-apple/pull/44)
|
||||
|
||||
### Fixed
|
||||
- Handle different JWT::decode signatures [#54](https://github.com/patrickbussmann/oauth2-apple/pull/54)
|
||||
|
||||
## 0.2.10 - 2022-10-01
|
||||
|
||||
### Added
|
||||
- "sub" to Resource Owner->toArray() [#38](https://github.com/patrickbussmann/oauth2-apple/pull/38)
|
||||
- Apple Key retrieval when using Guzzle Logging [#39](https://github.com/patrickbussmann/oauth2-apple/pull/39)
|
||||
|
||||
## 0.2.9 - 2022-07-09
|
||||
|
||||
### Added
|
||||
- Method for revoking access and refresh tokens [#37](https://github.com/patrickbussmann/oauth2-apple/issues/37)
|
||||
|
||||
## 0.2.8 - 2022-05-10
|
||||
|
||||
### Fixed
|
||||
- Issue with firebase/php-jwt v5 [#34](https://github.com/patrickbussmann/oauth2-apple/issues/34) (thanks to [tjveldhuizen](https://github.com/tjveldhuizen))
|
||||
|
||||
## 0.2.7 - 2022-04-29
|
||||
|
||||
### Added
|
||||
- Support for firebase/php-jwt v6 [#31](https://github.com/patrickbussmann/oauth2-apple/pull/31) (thanks to [bashgeek](https://github.com/bashgeek))
|
||||
|
||||
## 0.2.6 - 2021-08-25
|
||||
|
||||
### Added
|
||||
- GitHub Actions CI
|
||||
|
||||
### Removed
|
||||
- Travis CI
|
||||
|
||||
### Fixed
|
||||
- Fixed bug with serialization of AppleAccessToken [#29](https://github.com/patrickbussmann/oauth2-apple/pull/29) (thanks to [tjveldhuizen](https://github.com/tjveldhuizen))
|
||||
|
||||
## 0.2.5 - 2021-03-10
|
||||
|
||||
### Fixed
|
||||
- Fix BC-break for combination of PHP 7.4 and lcobucci/jwt 3.4 [#25](https://github.com/patrickbussmann/oauth2-apple/pull/25) (thanks to [tjveldhuizen](https://github.com/tjveldhuizen))
|
||||
|
||||
## 0.2.4 - 2021-01-17
|
||||
|
||||
### Added
|
||||
- Codecov for Code Coverage
|
||||
|
||||
### Fixed
|
||||
- Few compatibility issues with PHP 8 and PHP 5.6 (Read [#16](https://github.com/patrickbussmann/oauth2-apple/pull/16) for more details)
|
||||
|
||||
## 0.2.3 - 2021-01-05
|
||||
|
||||
### Added
|
||||
- Using guzzle http instead of file_get_contents [#14](https://github.com/patrickbussmann/oauth2-apple/pull/14)/[#17](https://github.com/patrickbussmann/oauth2-apple/pull/17) (thanks to [jmalinens](https://github.com/jmalinens) and [williamxsp](https://github.com/williamxsp))
|
||||
- README no scope instruction [#15](https://github.com/patrickbussmann/oauth2-apple/pull/15) (thanks to [NgSekLong](https://github.com/NgSekLong))
|
||||
- README leeway usage [#18](https://github.com/patrickbussmann/oauth2-apple/issues/18) (thanks to [lukequinnell](https://github.com/lukequinnell))
|
||||
|
||||
### Fixed
|
||||
- Fixed getting first and last name issues [#13](https://github.com/patrickbussmann/oauth2-apple/pull/13) (thanks to [bogdandovgopol](https://github.com/bogdandovgopol))
|
||||
|
||||
## 0.2.1 - 2020-02-13
|
||||
|
||||
### Added
|
||||
- Nothing
|
||||
|
||||
### Deprecated
|
||||
- Nothing
|
||||
|
||||
### Fixed
|
||||
- Handling of Apples JSON Web Key Set
|
||||
- Undefined index: code [#4](https://github.com/patrickbussmann/oauth2-apple/pull/4) (thanks to [Darlinkster](https://github.com/Darlinkster))
|
||||
|
||||
### Removed
|
||||
- Nothing
|
||||
|
||||
### Security
|
||||
- Nothing
|
||||
|
||||
## 0.2.0 - 2019-10-31
|
||||
|
||||
### Added
|
||||
- PHP 5.6 compatibility
|
||||
- More test cases
|
||||
|
||||
### Deprecated
|
||||
- Nothing
|
||||
|
||||
### Fixed
|
||||
- Nothing
|
||||
|
||||
### Removed
|
||||
- Nothing
|
||||
|
||||
### Security
|
||||
- Nothing
|
||||
|
||||
## 0.1.0 - 2019-10-18
|
||||
|
||||
### Added
|
||||
- Initial release!
|
||||
|
||||
### Deprecated
|
||||
- Nothing
|
||||
|
||||
### Fixed
|
||||
- Nothing
|
||||
|
||||
### Removed
|
||||
- Nothing
|
||||
|
||||
### Security
|
||||
- Nothing
|
||||
42
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/CONTRIBUTING.md
vendored
Normal file
42
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# Contributing
|
||||
|
||||
Contributions are **welcome** and will be fully **credited**.
|
||||
|
||||
We accept contributions via Pull Requests on [Github](https://github.com/patrickbussmann/oauth2-apple).
|
||||
|
||||
|
||||
## Pull Requests
|
||||
|
||||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
|
||||
|
||||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
|
||||
|
||||
- **Document any change in behaviour** - Make sure the README and any other relevant documentation are kept up-to-date.
|
||||
|
||||
- **Consider our release cycle** - We try to follow SemVer. Randomly breaking public APIs is not an option.
|
||||
|
||||
- **Create topic branches** - Don't ask us to pull from your master branch.
|
||||
|
||||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
|
||||
|
||||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
|
||||
|
||||
- **Ensure tests pass!** - Please run the tests (see below) before submitting your pull request, and make sure they pass. We won't accept a patch until all tests pass.
|
||||
|
||||
- **Ensure no coding standards violations** - Please run PHP Code Sniffer using the PSR-2 standard (see below) before submitting your pull request. A violation will cause the build to fail, so please make sure there are no violations. We can't accept a patch if the build fails.
|
||||
|
||||
|
||||
## Running Tests
|
||||
|
||||
``` bash
|
||||
$ ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
|
||||
## Running PHP Code Sniffer
|
||||
|
||||
``` bash
|
||||
$ ./vendor/bin/phpcs src --standard=psr2 -sp
|
||||
```
|
||||
|
||||
**Happy coding**!
|
||||
21
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/LICENSE
vendored
Normal file
21
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Patrick Bußmann
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
172
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/README.md
vendored
Normal file
172
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/README.md
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
# Sign in with Apple ID Provider for OAuth 2.0 Client
|
||||
[](https://github.com/patrickbussmann/oauth2-apple/releases)
|
||||
[](LICENSE.md)
|
||||
[](https://travis-ci.org/patrickbussmann/oauth2-apple)
|
||||
[](https://scrutinizer-ci.com/g/patrickbussmann/oauth2-apple/code-structure)
|
||||
[](https://scrutinizer-ci.com/g/patrickbussmann/oauth2-apple)
|
||||
[](https://codecov.io/gh/patrickbussmann/oauth2-apple)
|
||||
[](https://packagist.org/packages/patrickbussmann/oauth2-apple)
|
||||
|
||||
This package provides Apple ID OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).
|
||||
|
||||
## Before You Begin
|
||||
|
||||
Here you can find the official Apple documentation:
|
||||
https://developer.apple.com/documentation/signinwithapplerestapi
|
||||
|
||||
If you request email address or name please note that you'll get this only in your first login.
|
||||
When you log in a second time you will only get the user id - nothing more.
|
||||
Maybe Apple changes this sometime.
|
||||
|
||||
## Installation
|
||||
|
||||
To install, use composer:
|
||||
|
||||
```
|
||||
composer require patrickbussmann/oauth2-apple
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Usage is the same as The League's OAuth client, using `\League\OAuth2\Client\Provider\Apple` as the provider.
|
||||
|
||||
### Authorization Code Flow
|
||||
|
||||
```php
|
||||
// $leeway is needed for clock skew
|
||||
Firebase\JWT\JWT::$leeway = 60;
|
||||
|
||||
$provider = new League\OAuth2\Client\Provider\Apple([
|
||||
'clientId' => '{apple-client-id}',
|
||||
'teamId' => '{apple-team-id}', // 1A234BFK46 https://developer.apple.com/account/#/membership/ (Team ID)
|
||||
'keyFileId' => '{apple-key-file-id}', // 1ABC6523AA https://developer.apple.com/account/resources/authkeys/list (Key ID)
|
||||
'keyFilePath' => '{apple-key-file-path}', // __DIR__ . '/AuthKey_1ABC6523AA.p8' -> Download key above
|
||||
'redirectUri' => 'https://example.com/callback-url',
|
||||
]);
|
||||
|
||||
if (!isset($_POST['code'])) {
|
||||
|
||||
// If we don't have an authorization code then get one
|
||||
$authUrl = $provider->getAuthorizationUrl();
|
||||
$_SESSION['oauth2state'] = $provider->getState();
|
||||
header('Location: '.$authUrl);
|
||||
exit;
|
||||
|
||||
// Check given state against previously stored one to mitigate CSRF attack
|
||||
} elseif (empty($_POST['state']) || ($_POST['state'] !== $_SESSION['oauth2state'])) {
|
||||
|
||||
unset($_SESSION['oauth2state']);
|
||||
exit('Invalid state');
|
||||
|
||||
} else {
|
||||
|
||||
// Try to get an access token (using the authorization code grant)
|
||||
/** @var AppleAccessToken $token */
|
||||
$token = $provider->getAccessToken('authorization_code', [
|
||||
'code' => $_POST['code']
|
||||
]);
|
||||
|
||||
// Optional: Now you have a token you can look up a users profile data
|
||||
// Important: The most details are only visible in the very first login!
|
||||
// In the second and third and ... ones you'll only get the identifier of the user!
|
||||
try {
|
||||
|
||||
// We got an access token, let's now get the user's details
|
||||
$user = $provider->getResourceOwner($token);
|
||||
|
||||
// Use these details to create a new profile
|
||||
printf('Hello %s!', $user->getFirstName());
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// Failed to get user details
|
||||
exit(':-(');
|
||||
}
|
||||
|
||||
// Use this to interact with an API on the users behalf
|
||||
echo $token->getToken();
|
||||
}
|
||||
```
|
||||
|
||||
### Revoke Code Flow
|
||||
|
||||
```php
|
||||
// $leeway is needed for clock skew
|
||||
Firebase\JWT\JWT::$leeway = 60;
|
||||
|
||||
$provider = new League\OAuth2\Client\Provider\Apple([
|
||||
'clientId' => '{apple-client-id}',
|
||||
'teamId' => '{apple-team-id}', // 1A234BFK46 https://developer.apple.com/account/#/membership/ (Team ID)
|
||||
'keyFileId' => '{apple-key-file-id}', // 1ABC6523AA https://developer.apple.com/account/resources/authkeys/list (Key ID)
|
||||
'keyFilePath' => '{apple-key-file-path}', // __DIR__ . '/AuthKey_1ABC6523AA.p8' -> Download key above
|
||||
'redirectUri' => 'https://example.com/callback-url',
|
||||
]);
|
||||
|
||||
$token = $token->getToken(); // Use the token of "Authorization Code Flow" which you saved somewhere for the user
|
||||
|
||||
|
||||
try {
|
||||
$provider->revokeAccessToken($token /*, 'access_token' or 'refresh_token' */);
|
||||
// Successfully revoked the token!
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
// Failed to revoke
|
||||
exit(':-(');
|
||||
}
|
||||
```
|
||||
|
||||
### Managing Scopes
|
||||
|
||||
When creating your Apple authorization URL, you can specify the state and scopes your application may authorize.
|
||||
|
||||
```php
|
||||
$options = [
|
||||
'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
|
||||
// Scopes: https://developer.apple.com/documentation/authenticationservices/asauthorizationscope
|
||||
'scope' => ['name', 'email'] // array or string
|
||||
];
|
||||
|
||||
$authorizationUrl = $provider->getAuthorizationUrl($options);
|
||||
```
|
||||
If neither are defined, the provider will utilize internal defaults.
|
||||
|
||||
At the time of authoring this documentation, the following scopes are available.
|
||||
|
||||
- name (default)
|
||||
- email (default)
|
||||
|
||||
Please note that you will get this informations only at the first log in of the user!
|
||||
In the following log ins you'll get only the user id!
|
||||
|
||||
If you only want to get the user id, you can set the `scope` as ` `, then change all the `$_POST` to `$_GET`.
|
||||
|
||||
### Refresh Tokens
|
||||
|
||||
If your access token expires you can refresh them with the refresh token.
|
||||
|
||||
```
|
||||
$refreshToken = $token->getRefreshToken();
|
||||
$refreshTokenExpiration = $token->getRefreshTokenExpires();
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
``` bash
|
||||
$ ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see [CONTRIBUTING](https://github.com/patrickbussmann/oauth2-apple/blob/main/CONTRIBUTING.md) for details.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
- [All Contributors](https://github.com/patrickbussmann/oauth2-apple/contributors)
|
||||
|
||||
Template for this repository was the [LinkedIn](https://github.com/thephpleague/oauth2-linkedin).
|
||||
|
||||
## License
|
||||
|
||||
The MIT License (MIT). Please see [License File](https://github.com/patrickbussmann/oauth2-apple/blob/main/LICENSE) for more information.
|
||||
29
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/codecov.yml
vendored
Normal file
29
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/codecov.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
codecov:
|
||||
require_ci_to_pass: yes
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
round: down
|
||||
range: "70...100"
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: auto
|
||||
threshold: 0%
|
||||
patch:
|
||||
default:
|
||||
target: auto
|
||||
threshold: 0%
|
||||
|
||||
parsers:
|
||||
gcov:
|
||||
branch_detection:
|
||||
conditional: yes
|
||||
loop: yes
|
||||
method: no
|
||||
macro: no
|
||||
|
||||
comment:
|
||||
layout: "reach,diff,flags,tree"
|
||||
behavior: default
|
||||
require_changes: false
|
||||
49
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/composer.json
vendored
Normal file
49
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/composer.json
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "patrickbussmann\/oauth2-apple",
|
||||
"description": "Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Patrick Bu\u00dfmann",
|
||||
"email": "patrick.bussmann@bussmann-it.de",
|
||||
"homepage": "https:\/\/github.com\/patrickbussmann"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"oauth",
|
||||
"oauth2",
|
||||
"client",
|
||||
"authorization",
|
||||
"authorisation",
|
||||
"apple",
|
||||
"sign-in-with-apple"
|
||||
],
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"league\/oauth2-client": "^2.0",
|
||||
"firebase\/php-jwt": "^5.2 || ^6.0",
|
||||
"lcobucci\/jwt": "^3.4 || ^4.0 || ^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^5.7 || ^6.0 || ^9.3",
|
||||
"mockery\/mockery": "^1.3",
|
||||
"php-parallel-lint\/php-parallel-lint": "^1.3",
|
||||
"squizlabs\/php_codesniffer": "^2.3 || ^3.0",
|
||||
"composer\/semver": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Pshowsso\\Scope68f5e85e9608b\\League\\OAuth2\\Client\\": "src\/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Pshowsso\\Scope68f5e85e9608b\\League\\OAuth2\\Client\\Test\\": "test\/src\/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.4.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/phpunit.xml
vendored
Normal file
23
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/phpunit.xml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage>
|
||||
<include>
|
||||
<directory suffix=".php">./</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory suffix=".php">./vendor</directory>
|
||||
<directory suffix=".php">./test</directory>
|
||||
</exclude>
|
||||
<report>
|
||||
<clover outputFile="./build/coverage/log/coverage.xml"/>
|
||||
<html outputDirectory="./build/coverage/html" lowUpperBound="35" highLowerBound="70"/>
|
||||
</report>
|
||||
</coverage>
|
||||
<logging/>
|
||||
<testsuites>
|
||||
<testsuite name="Package Test Suite">
|
||||
<directory suffix=".php">./test/</directory>
|
||||
<exclude>./test/ext/</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
254
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/src/Provider/Apple.php
vendored
Normal file
254
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/src/Provider/Apple.php
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider;
|
||||
|
||||
use Exception;
|
||||
use Pshowsso\Scope68f5e85e9608b\Firebase\JWT\JWK;
|
||||
use InvalidArgumentException;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Configuration;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer\Key\InMemory;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer\Key;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Grant\AbstractGrant;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\Exception\AppleAccessDeniedException;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token\AccessToken;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token\AccessTokenInterface;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token\AppleAccessToken;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Tool\BearerAuthorizationTrait;
|
||||
use Pshowsso\Scope68f5e85e9608b\Psr\Http\Message\ResponseInterface;
|
||||
class Apple extends AbstractProvider
|
||||
{
|
||||
use BearerAuthorizationTrait;
|
||||
/**
|
||||
* Default scopes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $defaultScopes = ['name', 'email'];
|
||||
/**
|
||||
* @var string the team id
|
||||
*/
|
||||
protected $teamId;
|
||||
/**
|
||||
* @var string the key file id
|
||||
*/
|
||||
protected $keyFileId;
|
||||
/**
|
||||
* @var string the key file path
|
||||
*/
|
||||
protected $keyFilePath;
|
||||
/**
|
||||
* Constructs Apple's OAuth 2.0 service provider.
|
||||
*
|
||||
* @param array $options
|
||||
* @param array $collaborators
|
||||
*/
|
||||
public function __construct(array $options = [], array $collaborators = [])
|
||||
{
|
||||
if (empty($options['teamId'])) {
|
||||
throw new InvalidArgumentException('Required option not passed: "teamId"');
|
||||
}
|
||||
if (empty($options['keyFileId'])) {
|
||||
throw new InvalidArgumentException('Required option not passed: "keyFileId"');
|
||||
}
|
||||
if (empty($options['keyFilePath'])) {
|
||||
throw new InvalidArgumentException('Required option not passed: "keyFilePath"');
|
||||
}
|
||||
parent::__construct($options, $collaborators);
|
||||
}
|
||||
/**
|
||||
* Creates an access token from a response.
|
||||
*
|
||||
* The grant that was used to fetch the response can be used to provide
|
||||
* additional context.
|
||||
*
|
||||
* @param array $response
|
||||
* @param AbstractGrant $grant
|
||||
* @return AccessTokenInterface
|
||||
*/
|
||||
protected function createAccessToken(array $response, AbstractGrant $grant)
|
||||
{
|
||||
return new AppleAccessToken($this->getAppleKeys(), $response);
|
||||
}
|
||||
/**
|
||||
* @return string[] Apple's JSON Web Keys
|
||||
*/
|
||||
private function getAppleKeys()
|
||||
{
|
||||
$response = $this->httpClient->request('GET', 'https://appleid.apple.com/auth/keys');
|
||||
if ($response && $response->getStatusCode() === 200) {
|
||||
return JWK::parseKeySet(json_decode($response->getBody()->__toString(), \true));
|
||||
}
|
||||
return [];
|
||||
}
|
||||
/**
|
||||
* Get the string used to separate scopes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getScopeSeparator()
|
||||
{
|
||||
return ' ';
|
||||
}
|
||||
/**
|
||||
* Change response mode when scope requires it
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAuthorizationParameters(array $options)
|
||||
{
|
||||
$options = parent::getAuthorizationParameters($options);
|
||||
if (strpos($options['scope'], 'name') !== \false || strpos($options['scope'], 'email') !== \false) {
|
||||
$options['response_mode'] = 'form_post';
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
/**
|
||||
* @param AccessToken $token
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function fetchResourceOwnerDetails(AccessToken $token)
|
||||
{
|
||||
return json_decode(array_key_exists('user', $_GET) ? $_GET['user'] : (array_key_exists('user', $_POST) ? $_POST['user'] : '[]'), \true) ?: [];
|
||||
}
|
||||
/**
|
||||
* Get authorization url to begin OAuth flow
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseAuthorizationUrl()
|
||||
{
|
||||
return 'https://appleid.apple.com/auth/authorize';
|
||||
}
|
||||
/**
|
||||
* Get access token url to retrieve token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseAccessTokenUrl(array $params)
|
||||
{
|
||||
return 'https://appleid.apple.com/auth/token';
|
||||
}
|
||||
/**
|
||||
* Get revoke token url to revoke token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBaseRevokeTokenUrl(array $params)
|
||||
{
|
||||
return 'https://appleid.apple.com/auth/revoke';
|
||||
}
|
||||
/**
|
||||
* Get provider url to fetch user details
|
||||
*
|
||||
* @param AccessToken $token
|
||||
*
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getResourceOwnerDetailsUrl(AccessToken $token)
|
||||
{
|
||||
throw new Exception('No Apple ID REST API available yet!');
|
||||
}
|
||||
/**
|
||||
* Get the default scopes used by this provider.
|
||||
*
|
||||
* This should not be a complete list of all scopes, but the minimum
|
||||
* required for the provider user interface!
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getDefaultScopes()
|
||||
{
|
||||
return $this->defaultScopes;
|
||||
}
|
||||
/**
|
||||
* Check a provider response for errors.
|
||||
*
|
||||
* @param ResponseInterface $response
|
||||
* @param array $data Parsed response data
|
||||
* @return void
|
||||
* @throws AppleAccessDeniedException
|
||||
*/
|
||||
protected function checkResponse(ResponseInterface $response, $data)
|
||||
{
|
||||
if ($response->getStatusCode() >= 400) {
|
||||
throw new AppleAccessDeniedException(array_key_exists('error', $data) ? $data['error'] : $response->getReasonPhrase(), array_key_exists('code', $data) ? $data['code'] : $response->getStatusCode(), $response);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generate a user object from a successful user details request.
|
||||
*
|
||||
* @param array $response
|
||||
* @param AccessToken $token
|
||||
* @return AppleResourceOwner
|
||||
*/
|
||||
protected function createResourceOwner(array $response, AccessToken $token)
|
||||
{
|
||||
return new AppleResourceOwner(array_merge(['sub' => $token->getResourceOwnerId()], $response, ['email' => isset($token->getValues()['email']) ? $token->getValues()['email'] : (isset($response['email']) ? $response['email'] : null), 'isPrivateEmail' => $token instanceof AppleAccessToken ? $token->isPrivateEmail() : null]), $token->getResourceOwnerId());
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAccessToken($grant, array $options = [])
|
||||
{
|
||||
$configuration = $this->getConfiguration();
|
||||
$time = new \DateTimeImmutable();
|
||||
$time = $time->setTime($time->format('H'), $time->format('i'), $time->format('s'));
|
||||
$expiresAt = $time->modify('+1 Hour');
|
||||
$expiresAt = $expiresAt->setTime($expiresAt->format('H'), $expiresAt->format('i'), $expiresAt->format('s'));
|
||||
$token = $configuration->builder()->issuedBy($this->teamId)->permittedFor('https://appleid.apple.com')->issuedAt($time)->expiresAt($expiresAt)->relatedTo($this->clientId)->withHeader('alg', 'ES256')->withHeader('kid', $this->keyFileId)->getToken($configuration->signer(), $configuration->signingKey());
|
||||
$options += ['client_secret' => $token->toString()];
|
||||
return parent::getAccessToken($grant, $options);
|
||||
}
|
||||
/**
|
||||
* Revokes an access or refresh token using a specified token.
|
||||
*
|
||||
* @param string $token
|
||||
* @param string|null $tokenTypeHint
|
||||
* @return \Psr\Http\Message\RequestInterface
|
||||
*/
|
||||
public function revokeAccessToken($token, $tokenTypeHint = null)
|
||||
{
|
||||
$configuration = $this->getConfiguration();
|
||||
$time = new \DateTimeImmutable();
|
||||
$time = $time->setTime($time->format('H'), $time->format('i'), $time->format('s'));
|
||||
$expiresAt = $time->modify('+1 Hour');
|
||||
$expiresAt = $expiresAt->setTime($expiresAt->format('H'), $expiresAt->format('i'), $expiresAt->format('s'));
|
||||
$clientSecret = $configuration->builder()->issuedBy($this->teamId)->permittedFor('https://appleid.apple.com')->issuedAt($time)->expiresAt($expiresAt)->relatedTo($this->clientId)->withHeader('alg', 'ES256')->withHeader('kid', $this->keyFileId)->getToken($configuration->signer(), $configuration->signingKey());
|
||||
$params = ['client_id' => $this->clientId, 'client_secret' => $clientSecret->toString(), 'token' => $token];
|
||||
if ($tokenTypeHint !== null) {
|
||||
$params += ['token_type_hint' => $tokenTypeHint];
|
||||
}
|
||||
$method = $this->getAccessTokenMethod();
|
||||
$url = $this->getBaseRevokeTokenUrl($params);
|
||||
if (property_exists($this, 'optionProvider')) {
|
||||
$options = $this->optionProvider->getAccessTokenOptions(self::METHOD_POST, $params);
|
||||
} else {
|
||||
$options = $this->getAccessTokenOptions($params);
|
||||
}
|
||||
$request = $this->getRequest($method, $url, $options);
|
||||
return $this->getParsedResponse($request);
|
||||
}
|
||||
/**
|
||||
* @return Configuration
|
||||
*/
|
||||
public function getConfiguration()
|
||||
{
|
||||
if (method_exists(Signer\Ecdsa\Sha256::class, 'create')) {
|
||||
return Configuration::forSymmetricSigner(Signer\Ecdsa\Sha256::create(), $this->getLocalKey());
|
||||
} else {
|
||||
return Configuration::forSymmetricSigner(new Signer\Ecdsa\Sha256(), $this->getLocalKey());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return Key
|
||||
*/
|
||||
public function getLocalKey()
|
||||
{
|
||||
return InMemory::file($this->keyFilePath);
|
||||
}
|
||||
}
|
||||
98
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/src/Provider/AppleResourceOwner.php
vendored
Normal file
98
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/src/Provider/AppleResourceOwner.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Tool\ArrayAccessorTrait;
|
||||
/**
|
||||
* @property array $response
|
||||
* @property string $uid
|
||||
*/
|
||||
class AppleResourceOwner extends GenericResourceOwner
|
||||
{
|
||||
use ArrayAccessorTrait;
|
||||
/**
|
||||
* Raw response
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $response = [];
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $email;
|
||||
/**
|
||||
* @var boolean true when its private relay from apple else the user mail address
|
||||
*/
|
||||
private $isPrivateEmail;
|
||||
/**
|
||||
* Gets resource owner attribute by key. The key supports dot notation.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute($key)
|
||||
{
|
||||
return $this->getValueByKey($this->response, (string) $key);
|
||||
}
|
||||
/**
|
||||
* Get user first name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
$name = $this->getAttribute('name');
|
||||
if (isset($name)) {
|
||||
return $name['firstName'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Get user user id
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->resourceOwnerId;
|
||||
}
|
||||
/**
|
||||
* Get user last name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
$name = $this->getAttribute('name');
|
||||
if (isset($name)) {
|
||||
return $name['lastName'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Get user email, if available
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->getAttribute('email');
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPrivateEmail()
|
||||
{
|
||||
return (bool) $this->getAttribute('isPrivateEmail');
|
||||
}
|
||||
/**
|
||||
* Return all of the owner details available as an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\Exception;
|
||||
|
||||
class AppleAccessDeniedException extends IdentityProviderException
|
||||
{
|
||||
}
|
||||
103
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/src/Token/AppleAccessToken.php
vendored
Normal file
103
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/src/Token/AppleAccessToken.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\Firebase\JWT\JWT;
|
||||
use Pshowsso\Scope68f5e85e9608b\Firebase\JWT\Key;
|
||||
use InvalidArgumentException;
|
||||
class AppleAccessToken extends AccessToken
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $idToken;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $email;
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $isPrivateEmail;
|
||||
/**
|
||||
* Constructs an access token.
|
||||
*
|
||||
* @param Key[] $keys Valid Apple JWT keys
|
||||
* @param array $options An array of options returned by the service provider
|
||||
* in the access token request. The `access_token` option is required.
|
||||
* @throws InvalidArgumentException if `access_token` is not provided in `$options`.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct(array $keys, array $options = [])
|
||||
{
|
||||
if (array_key_exists('refresh_token', $options)) {
|
||||
if (empty($options['id_token'])) {
|
||||
throw new InvalidArgumentException('Required option not passed: "id_token"');
|
||||
}
|
||||
$decoded = null;
|
||||
$last = end($keys);
|
||||
foreach ($keys as $key) {
|
||||
try {
|
||||
try {
|
||||
$decoded = JWT::decode($options['id_token'], $key);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
$decodeMethodReflection = new \ReflectionMethod(JWT::class, 'decode');
|
||||
$decodeMethodParameters = $decodeMethodReflection->getParameters();
|
||||
// Backwards compatibility for firebase/php-jwt >=5.2.0 <=5.5.1 supported by PHP 5.6
|
||||
if (array_key_exists(2, $decodeMethodParameters) && 'allowed_algs' === $decodeMethodParameters[2]->getName()) {
|
||||
$decoded = JWT::decode($options['id_token'], $key, ['RS256']);
|
||||
} else {
|
||||
$headers = (object) ['alg' => 'RS256'];
|
||||
$decoded = JWT::decode($options['id_token'], $key, $headers);
|
||||
}
|
||||
}
|
||||
break;
|
||||
} catch (\Exception $exception) {
|
||||
if ($last === $key) {
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null === $decoded) {
|
||||
throw new \Exception('Got no data within "id_token"!');
|
||||
}
|
||||
$payload = json_decode(json_encode($decoded), \true);
|
||||
$options['resource_owner_id'] = $payload['sub'];
|
||||
if (isset($payload['email_verified']) && $payload['email_verified']) {
|
||||
$options['email'] = $payload['email'];
|
||||
}
|
||||
if (isset($payload['is_private_email'])) {
|
||||
$this->isPrivateEmail = $payload['is_private_email'];
|
||||
}
|
||||
}
|
||||
parent::__construct($options);
|
||||
if (isset($options['id_token'])) {
|
||||
$this->idToken = $options['id_token'];
|
||||
}
|
||||
if (isset($options['email'])) {
|
||||
$this->email = $options['email'];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIdToken()
|
||||
{
|
||||
return $this->idToken;
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isPrivateEmail()
|
||||
{
|
||||
return $this->isPrivateEmail;
|
||||
}
|
||||
}
|
||||
25
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/ext/KeyDumpSigner5.php
vendored
Normal file
25
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/ext/KeyDumpSigner5.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signature;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer;
|
||||
final class KeyDumpSigner implements Signer
|
||||
{
|
||||
public function getAlgorithmId()
|
||||
{
|
||||
return 'keydump';
|
||||
}
|
||||
public function modifyHeader(array &$headers)
|
||||
{
|
||||
$headers['alg'] = $this->getAlgorithmId();
|
||||
}
|
||||
public function verify($expected, $payload, $key)
|
||||
{
|
||||
return $expected === $key->contents();
|
||||
}
|
||||
public function sign($payload, $key)
|
||||
{
|
||||
return new Signature($key->contents());
|
||||
}
|
||||
}
|
||||
21
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/ext/KeyDumpSigner8.php
vendored
Normal file
21
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/ext/KeyDumpSigner8.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer\Key;
|
||||
final class KeyDumpSigner implements Signer
|
||||
{
|
||||
public function algorithmId(): string
|
||||
{
|
||||
return 'keydump';
|
||||
}
|
||||
public function sign(string $payload, Key $key): string
|
||||
{
|
||||
return $key->contents();
|
||||
}
|
||||
public function verify(string $expected, string $payload, Key $key): bool
|
||||
{
|
||||
return $expected === $key->contents();
|
||||
}
|
||||
}
|
||||
11
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/KeyDumpSignerLoader.php
vendored
Normal file
11
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/KeyDumpSignerLoader.php
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Composer\Semver\VersionParser;
|
||||
if (!InstalledVersions::satisfies(new VersionParser(), 'lcobucci/jwt', '^1 || ^2 || ^3')) {
|
||||
require_once __DIR__ . '/../ext/KeyDumpSigner8.php';
|
||||
} else {
|
||||
require_once __DIR__ . '/../ext/KeyDumpSigner5.php';
|
||||
}
|
||||
226
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/Provider/AppleTest.php
vendored
Normal file
226
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/Provider/AppleTest.php
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test\Provider;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\GuzzleHttp\ClientInterface;
|
||||
use Pshowsso\Scope68f5e85e9608b\GuzzleHttp\Psr7\Response;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Configuration;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer\Key;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer\Hmac\Sha256;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\Apple;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\AppleResourceOwner;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test\KeyDumpSigner;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token\AccessToken;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token\AppleAccessToken;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Tool\QueryBuilderTrait;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Mockery as m;
|
||||
class AppleTest extends TestCase
|
||||
{
|
||||
use QueryBuilderTrait;
|
||||
/**
|
||||
* @return Apple
|
||||
*/
|
||||
private function getProvider()
|
||||
{
|
||||
return new Apple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFileId' => 'mock.file.id', 'keyFilePath' => __DIR__ . '/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
}
|
||||
public function testMissingTeamIdDuringInstantiationThrowsException()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
new Apple(['clientId' => 'mock.example', 'keyFileId' => 'mock.file.id', 'keyFilePath' => __DIR__ . '/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
}
|
||||
public function testMissingKeyFileIdDuringInstantiationThrowsException()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
new Apple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFilePath' => __DIR__ . '/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
}
|
||||
public function testMissingKeyFilePathDuringInstantiationThrowsException()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
new Apple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFileId' => 'mock.file.id', 'redirectUri' => 'none']);
|
||||
}
|
||||
public function testMissingKeyDuringInstantiationThrowsException()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->getProvider()->getLocalKey();
|
||||
}
|
||||
public function testAuthorizationUrl()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$url = $provider->getAuthorizationUrl();
|
||||
$uri = parse_url($url);
|
||||
parse_str($uri['query'], $query);
|
||||
$this->assertArrayHasKey('client_id', $query);
|
||||
$this->assertArrayHasKey('redirect_uri', $query);
|
||||
$this->assertArrayHasKey('state', $query);
|
||||
$this->assertArrayHasKey('scope', $query);
|
||||
$this->assertArrayHasKey('response_type', $query);
|
||||
$this->assertArrayHasKey('response_mode', $query);
|
||||
$this->assertNotNull($provider->getState());
|
||||
}
|
||||
public function testScopes()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$scopeSeparator = ' ';
|
||||
$options = ['scope' => [uniqid(), uniqid()]];
|
||||
$query = ['scope' => implode($scopeSeparator, $options['scope'])];
|
||||
$url = $provider->getAuthorizationUrl($options);
|
||||
$encodedScope = $this->buildQueryString($query);
|
||||
$this->assertNotFalse(strpos($url, $encodedScope));
|
||||
}
|
||||
public function testGetAuthorizationUrl()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$url = $provider->getAuthorizationUrl();
|
||||
$uri = parse_url($url);
|
||||
$this->assertEquals('/auth/authorize', $uri['path']);
|
||||
}
|
||||
public function testGetBaseAccessTokenUrl()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$params = [];
|
||||
$url = $provider->getBaseAccessTokenUrl($params);
|
||||
$uri = parse_url($url);
|
||||
$this->assertEquals('/auth/token', $uri['path']);
|
||||
}
|
||||
public function testGetAccessToken()
|
||||
{
|
||||
$this->expectException('UnexpectedValueException');
|
||||
$provider = new TestApple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFileId' => 'mock.file.id', 'keyFilePath' => __DIR__ . '/../../resources/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
$provider = m::mock($provider);
|
||||
$configuration = Configuration::forSymmetricSigner(new KeyDumpSigner(), Key\InMemory::plainText('private'));
|
||||
$time = new \DateTimeImmutable();
|
||||
$expiresAt = $time->modify('+1 Hour');
|
||||
$token = $configuration->builder()->issuedBy('test-team-id')->permittedFor('https://appleid.apple.com')->issuedAt($time)->expiresAt($expiresAt)->relatedTo('test-client')->withHeader('alg', 'RS256')->withHeader('kid', 'test')->getToken($configuration->signer(), $configuration->signingKey());
|
||||
$client = m::mock(ClientInterface::class);
|
||||
$client->shouldReceive('request')->times(1)->andReturn(new Response(200, [], file_get_contents('https://appleid.apple.com/auth/keys')));
|
||||
$client->shouldReceive('send')->times(1)->andReturn(new Response(200, [], json_encode(['access_token' => 'aad897dee58fe4f66bf220c181adaf82b.0.mrwxq.hmiE0djj1vJqoNisKmF-pA', 'token_type' => 'Bearer', 'expires_in' => 3600, 'refresh_token' => 'r4a6e8b9c50104b78bc86b0d2649353fa.0.mrwxq.54joUj40j0cpuMANRtRjfg', 'id_token' => $token->toString()])));
|
||||
$provider->setHttpClient($client);
|
||||
$provider->getAccessToken('authorization_code', ['code' => 'hello-world']);
|
||||
}
|
||||
public function testGetAccessTokenFailedBecauseAppleHasError()
|
||||
{
|
||||
$this->expectException('Exception');
|
||||
$this->expectExceptionMessage('Got no data within "id_token"!');
|
||||
$provider = new TestApple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFileId' => 'mock.file.id', 'keyFilePath' => __DIR__ . '/../../resources/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
$provider = m::mock($provider);
|
||||
$client = m::mock(ClientInterface::class);
|
||||
$client->shouldReceive('request')->times(1)->andReturn(new Response(500, [], 'Internal Server Error'));
|
||||
$client->shouldReceive('send')->times(1)->andReturn(new Response(200, [], json_encode(['access_token' => 'aad897dee58fe4f66bf220c181adaf82b.0.mrwxq.hmiE0djj1vJqoNisKmF-pA', 'token_type' => 'Bearer', 'expires_in' => 3600, 'refresh_token' => 'r4a6e8b9c50104b78bc86b0d2649353fa.0.mrwxq.54joUj40j0cpuMANRtRjfg', 'id_token' => 'abc'])));
|
||||
$provider->setHttpClient($client);
|
||||
$provider->getAccessToken('authorization_code', ['code' => 'hello-world']);
|
||||
}
|
||||
public function testRevokeAccessToken()
|
||||
{
|
||||
$provider = new TestApple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFileId' => 'mock.file.id', 'keyFilePath' => __DIR__ . '/../../resources/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
$provider = m::mock($provider);
|
||||
$client = m::mock(ClientInterface::class);
|
||||
$client->shouldReceive('send')->times(1)->andReturn(new Response(200, [], json_encode([])));
|
||||
$provider->setHttpClient($client);
|
||||
$this->assertEmpty($provider->revokeAccessToken('hello-world', 'access_token'));
|
||||
}
|
||||
public function testRevokeAccessTokenFailedBecauseAppleHasError()
|
||||
{
|
||||
$this->expectException('Exception');
|
||||
$this->expectExceptionMessage('invalid_request');
|
||||
$provider = new TestApple(['clientId' => 'mock.example', 'teamId' => 'mock.team.id', 'keyFileId' => 'mock.file.id', 'keyFilePath' => __DIR__ . '/../../resources/p256-private-key.p8', 'redirectUri' => 'none']);
|
||||
$provider = m::mock($provider);
|
||||
$client = m::mock(ClientInterface::class);
|
||||
$client->shouldReceive('send')->times(1)->andReturn(new Response(400, [], json_encode(['error' => 'invalid_request'])));
|
||||
$provider->setHttpClient($client);
|
||||
$provider->revokeAccessToken('hello-world');
|
||||
}
|
||||
public function testFetchingOwnerDetails()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$class = new \ReflectionClass($provider);
|
||||
$method = $class->getMethod('fetchResourceOwnerDetails');
|
||||
$method->setAccessible(\true);
|
||||
$arr = ['name' => 'John Doe'];
|
||||
$_POST['user'] = json_encode($arr);
|
||||
$data = $method->invokeArgs($provider, [new AccessToken(['access_token' => 'hello'])]);
|
||||
$this->assertEquals($arr, $data);
|
||||
}
|
||||
/**
|
||||
* @see https://github.com/patrickbussmann/oauth2-apple/issues/12
|
||||
*/
|
||||
public function testFetchingOwnerDetailsIssue12()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$class = new \ReflectionClass($provider);
|
||||
$method = $class->getMethod('fetchResourceOwnerDetails');
|
||||
$method->setAccessible(\true);
|
||||
$_POST['user'] = '';
|
||||
$data = $method->invokeArgs($provider, [new AccessToken(['access_token' => 'hello'])]);
|
||||
$this->assertEquals([], $data);
|
||||
}
|
||||
public function testNotImplementedGetResourceOwnerDetailsUrl()
|
||||
{
|
||||
$this->expectException('Exception');
|
||||
$provider = $this->getProvider();
|
||||
$provider->getResourceOwnerDetailsUrl(new AccessToken(['access_token' => 'hello']));
|
||||
}
|
||||
public function testCheckResponse()
|
||||
{
|
||||
$this->expectException('Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\Exception\AppleAccessDeniedException');
|
||||
$this->expectExceptionMessage('invalid_client');
|
||||
$provider = $this->getProvider();
|
||||
$class = new \ReflectionClass($provider);
|
||||
$method = $class->getMethod('checkResponse');
|
||||
$method->setAccessible(\true);
|
||||
$method->invokeArgs($provider, [new Response(400, []), ['error' => 'invalid_client', 'code' => 400]]);
|
||||
}
|
||||
public function testResourceToArrayHasAttributes()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$class = new \ReflectionClass($provider);
|
||||
$method = $class->getMethod('createResourceOwner');
|
||||
$method->setAccessible(\true);
|
||||
/** @var AppleResourceOwner $data */
|
||||
$data = $method->invokeArgs($provider, [[
|
||||
'email' => 'john@doe.com',
|
||||
// <- Fake E-Mail from user input
|
||||
'name' => ['firstName' => 'John', 'lastName' => 'Doe'],
|
||||
], new AccessToken(['access_token' => 'hello', 'email' => 'john@doe.de', 'resource_owner_id' => '123.4.567'])]);
|
||||
$expectedArray = ['email' => 'john@doe.de', 'sub' => '123.4.567', 'name' => ['firstName' => 'John', 'lastName' => 'Doe'], 'isPrivateEmail' => null];
|
||||
$this->assertEquals($expectedArray, $data->toArray());
|
||||
}
|
||||
public function testCreationOfResourceOwnerWithName()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$class = new \ReflectionClass($provider);
|
||||
$method = $class->getMethod('createResourceOwner');
|
||||
$method->setAccessible(\true);
|
||||
/** @var AppleResourceOwner $data */
|
||||
$data = $method->invokeArgs($provider, [[
|
||||
'email' => 'john@doe.com',
|
||||
// <- Fake E-Mail from user input
|
||||
'name' => ['firstName' => 'John', 'lastName' => 'Doe'],
|
||||
], new AccessToken(['access_token' => 'hello', 'email' => 'john@doe.de', 'resource_owner_id' => '123.4.567'])]);
|
||||
$this->assertEquals('john@doe.de', $data->getEmail());
|
||||
$this->assertEquals('Doe', $data->getLastName());
|
||||
$this->assertEquals('John', $data->getFirstName());
|
||||
$this->assertEquals('123.4.567', $data->getId());
|
||||
$this->assertFalse($data->isPrivateEmail());
|
||||
$this->assertArrayHasKey('name', $data->toArray());
|
||||
}
|
||||
public function testCreationOfResourceOwnerWithoutName()
|
||||
{
|
||||
$provider = $this->getProvider();
|
||||
$class = new \ReflectionClass($provider);
|
||||
$method = $class->getMethod('createResourceOwner');
|
||||
$method->setAccessible(\true);
|
||||
/** @var AppleResourceOwner $data */
|
||||
$data = $method->invokeArgs($provider, [[], new AccessToken(['access_token' => 'hello', 'email' => 'john@doe.de', 'resource_owner_id' => '123.4.567'])]);
|
||||
$this->assertEquals('john@doe.de', $data->getEmail());
|
||||
$this->assertNull($data->getLastName());
|
||||
$this->assertNull($data->getFirstName());
|
||||
}
|
||||
public function testGetConfiguration()
|
||||
{
|
||||
$provider = m::mock(Apple::class)->makePartial();
|
||||
$provider->shouldReceive('getLocalKey')->andReturn(m::mock(Key::class));
|
||||
$this->assertInstanceOf(Configuration::class, $provider->getConfiguration());
|
||||
}
|
||||
}
|
||||
30
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/Provider/TestApple.php
vendored
Normal file
30
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/Provider/TestApple.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test\Provider;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Configuration;
|
||||
use Pshowsso\Scope68f5e85e9608b\Lcobucci\JWT\Signer\Key\InMemory;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Provider\Apple;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test\KeyDumpSigner;
|
||||
/**
|
||||
* Class TestApple
|
||||
* @package League\OAuth2\Client\Test\Provider
|
||||
* @author Patrick Bußmann <patrick.bussmann@bussmann-it.de>
|
||||
*/
|
||||
class TestApple extends Apple
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfiguration()
|
||||
{
|
||||
return Configuration::forSymmetricSigner(new KeyDumpSigner(), InMemory::plainText('private'));
|
||||
}
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocalKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
50
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/Token/AppleAccessTokenTest.php
vendored
Normal file
50
modules/pshowsso/vendor/patrickbussmann/oauth2-apple/test/src/Token/AppleAccessTokenTest.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Test\Token;
|
||||
|
||||
use Pshowsso\Scope68f5e85e9608b\Firebase\JWT\Key;
|
||||
use Pshowsso\Scope68f5e85e9608b\League\OAuth2\Client\Token\AppleAccessToken;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Mockery as m;
|
||||
class AppleAccessTokenTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testCreatingAccessToken()
|
||||
{
|
||||
$externalJWTMock = m::mock('overload:Firebase\JWT\JWT');
|
||||
$externalJWTMock->shouldReceive('decode')->with('something', 'examplekey')->once()->andReturn(['sub' => '123.abc.123', 'email_verified' => \true, 'email' => 'john@doe.com', 'is_private_email' => \true]);
|
||||
$accessToken = new AppleAccessToken(['examplekey'], ['access_token' => 'access_token', 'token_type' => 'Bearer', 'expires_in' => 3600, 'refresh_token' => 'abc.0.def', 'id_token' => 'something']);
|
||||
$this->assertEquals('something', $accessToken->getIdToken());
|
||||
$this->assertEquals('123.abc.123', $accessToken->getResourceOwnerId());
|
||||
$this->assertEquals('access_token', $accessToken->getToken());
|
||||
$this->assertEquals('john@doe.com', $accessToken->getEmail());
|
||||
$this->assertTrue($accessToken->isPrivateEmail());
|
||||
$this->assertTrue(\true);
|
||||
}
|
||||
public function testCreateFailsBecauseNoIdTokenIsSet()
|
||||
{
|
||||
$this->expectException('\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Required option not passed: "id_token"');
|
||||
new AppleAccessToken(['examplekey'], ['access_token' => 'access_token', 'token_type' => 'Bearer', 'expires_in' => 3600, 'refresh_token' => 'abc.0.def']);
|
||||
}
|
||||
public function testCreatingRefreshToken()
|
||||
{
|
||||
$refreshToken = new AppleAccessToken([], ['access_token' => 'access_token', 'token_type' => 'Bearer', 'expires_in' => 3600]);
|
||||
$this->assertEquals('access_token', $refreshToken->getToken());
|
||||
}
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testCreatingAccessTokenFailsBecauseNoDecodingIsPossible()
|
||||
{
|
||||
$this->expectException('\Exception');
|
||||
$this->expectExceptionMessage('Got no data within "id_token"!');
|
||||
$externalJWTMock = m::mock('overload:Firebase\JWT\JWT');
|
||||
$externalJWTMock->shouldReceive('decode')->with('something', 'examplekey')->once()->andReturnNull();
|
||||
new AppleAccessToken(['examplekey'], ['access_token' => 'access_token', 'token_type' => 'Bearer', 'expires_in' => 3600, 'refresh_token' => 'abc.0.def', 'id_token' => 'something']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user