Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
12
vendor/genealabs/laravel-sign-in-with-apple/.github/FUNDING.yml
vendored
Normal file
12
vendor/genealabs/laravel-sign-in-with-apple/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [mikebronner]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
6
vendor/genealabs/laravel-sign-in-with-apple/.gitignore
vendored
Normal file
6
vendor/genealabs/laravel-sign-in-with-apple/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/vendor
|
||||
.phpunit.result.cache
|
||||
composer.lock
|
||||
phpmd.xml
|
||||
phpunit.xml
|
||||
/tests/Browser/screenshots
|
||||
51
vendor/genealabs/laravel-sign-in-with-apple/CHANGELOG.md
vendored
Normal file
51
vendor/genealabs/laravel-sign-in-with-apple/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.4.4] - 2020-09-04
|
||||
### Changed
|
||||
- storing of `access_token` to `id_token`.
|
||||
|
||||
## [0.4.3] - 2020-03-06
|
||||
### Udpated
|
||||
- dependencies.
|
||||
|
||||
## [0.4.2] - 2020-02-30
|
||||
### Fixed
|
||||
- name resolution from Apple's response. Thanks @poldixd!
|
||||
|
||||
## [0.4.1] - 2020-02-29
|
||||
### Fixed
|
||||
- service provider class name.
|
||||
|
||||
## [0.4.0] - 2020-02-29
|
||||
### Added
|
||||
- Laravel 7 compatibility.
|
||||
|
||||
## [0.3.0] - 2019-10-14
|
||||
### Removed
|
||||
- user resolution and persistence functionality and extracted it to a generic
|
||||
package that works with all socialite providers.
|
||||
|
||||
## [0.2.1] - 2019-10-13
|
||||
### Added
|
||||
- optional user persistence and automatic login functionality.
|
||||
|
||||
## [0.2.0] - 2019-10-13
|
||||
### Changed
|
||||
- blade directive for button from `@signInWithAppleButton(...)` to `@signInWithApple(...)`.
|
||||
|
||||
## [0.1.2] - 2019-10-13
|
||||
### Fixed
|
||||
- missing user's name is now being returned along with their email address.
|
||||
|
||||
## [0.1.1] - 2019-10-12
|
||||
### Fixed
|
||||
- env variable registration.
|
||||
- config merging.
|
||||
|
||||
## [0.1.0] - 2019-10-12
|
||||
### Added
|
||||
- initial functionality.
|
||||
46
vendor/genealabs/laravel-sign-in-with-apple/CODE_OF_CONDUCT.md
vendored
Normal file
46
vendor/genealabs/laravel-sign-in-with-apple/CODE_OF_CONDUCT.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@genealabs.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
35
vendor/genealabs/laravel-sign-in-with-apple/CONTRIBUTING.md
vendored
Normal file
35
vendor/genealabs/laravel-sign-in-with-apple/CONTRIBUTING.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# How to contribute
|
||||
We welcome everyone to submit pull requests with:
|
||||
- issue fixes
|
||||
- change suggestions
|
||||
- documentation updates
|
||||
|
||||
However, not every pull request will automatically be accepted. I will review each carefully to make sure it is in line with
|
||||
the direction I want the package to continue in. This might mean that some pull requests are not accepted, or might stay
|
||||
unmerged until a place for them can be determined.
|
||||
|
||||
## Testing
|
||||
- [ ] After making your changes, make sure the tests still pass.
|
||||
- [ ] When adding new functionality, also add new tests.
|
||||
- [ ] When fixing errors write and satisfy new unit tests that replicate the issue.
|
||||
- [ ] Make sure there are no build errors.
|
||||
- [ ] All code must past PHPCS and PHPMD PSR2 validation.
|
||||
|
||||
## Submitting changes
|
||||
When submitting a pull request, it is important to make sure to complete the following:
|
||||
- [ ] Add a descriptive header that explains in a single sentence what problem the PR solves.
|
||||
- [ ] Add a detailed description with animated screen-grab GIFs visualizing how it works.
|
||||
- [ ] Explain why you think it should be implemented one way vs. another, highlight performance improvements, etc.
|
||||
|
||||
## Coding conventions
|
||||
Start reading our code and you'll get the hang of it. We optimize for readability:
|
||||
- indent using four spaces (soft tabs)
|
||||
- use Blade for all views
|
||||
- avoid logic in views, put it in controllers or service classes
|
||||
- ALWAYS put spaces after list items and method parameters (`[1, 2, 3]`, not `[1,2,3]`), around operators (`x += 1`, not `x+=1`), and around hash arrows.
|
||||
- this is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.
|
||||
- emphasis readability of code over patterns to reduce mental debt
|
||||
- always add an empty line around structures (if statements, loops, etc.)
|
||||
|
||||
Thanks!
|
||||
Mike Bronner, GeneaLabs
|
||||
21
vendor/genealabs/laravel-sign-in-with-apple/LICENSE
vendored
Normal file
21
vendor/genealabs/laravel-sign-in-with-apple/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017 GeneaLabs, LLC <hello@genealabs.com>
|
||||
|
||||
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.
|
||||
229
vendor/genealabs/laravel-sign-in-with-apple/README.md
vendored
Normal file
229
vendor/genealabs/laravel-sign-in-with-apple/README.md
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
# Sign In With Apple for Laravel
|
||||
|
||||

|
||||
|
||||
## Supporting This Package
|
||||
|
||||
This is an MIT-licensed open source project with its ongoing development made possible by the support of the community. If you'd like to support this, and our other packages, please consider sponsoring us via the button above.
|
||||
|
||||
We thank the following sponsors for their generosity, please take a moment to check them out:
|
||||
|
||||
- [LIX](https://lix-it.com)
|
||||
|
||||
## Table of Contents
|
||||
- [Requirements](#Requirements)
|
||||
- [Installation](#Installation)
|
||||
- [Configuration](#Configuration)
|
||||
- [Implementation](#Implementation)
|
||||
- [Button](#Button)
|
||||
- [Controller](#Controller)
|
||||
|
||||
<a name="Requirements"></a>
|
||||
## Requirements
|
||||
|
||||
- PHP 7.3+
|
||||
- Laravel 8.0+
|
||||
- Socialite 5.0+
|
||||
- Apple Developer Subscription
|
||||
|
||||
<a name="Installation"></a>
|
||||
## Installation
|
||||
|
||||
<a href="https://vimeo.com/366353988"></a>
|
||||
|
||||
1. Install the composer package:
|
||||
```sh
|
||||
composer require genealabs/laravel-sign-in-with-apple
|
||||
```
|
||||
|
||||
We also recommend using [geneaLabs/laravel-socialiter](https://github.com/GeneaLabs/laravel-socialiter)
|
||||
to automatically manage user resolution and persistence:
|
||||
|
||||
```sh
|
||||
composer require genealabs/laravel-socialiter
|
||||
```
|
||||
|
||||
<a name="Configuration"></a>
|
||||
## Configuration
|
||||
|
||||
1. Create an `App ID` for your website (https://developer.apple.com/account/resources/identifiers/list/bundleId) with the following details:
|
||||
- Platform: iOS, tvOS, watchOS (I'm unsure if either choice has an effect for web apps)
|
||||
- Description: (something like "example.com app id")
|
||||
- Bundle ID (Explicit): com.example.id (or something similar)
|
||||
- Check "Sign In With Apple"
|
||||
2. Create a `Service ID` for your website (https://developer.apple.com/account/resources/identifiers/list/serviceId) with the following details:
|
||||
- Description: (something like "example.com service id")
|
||||
- Identifier: com.example.service (or something similar)
|
||||
- Check "Sign In With Apple"
|
||||
- Configure "Sign In With Apple":
|
||||
- Primary App Id: (select the primary app id created in step 1)
|
||||
- Web Domain: example.com (the domain of your web site)
|
||||
- Return URLs: https://example.com/apple-signin (the route pointing to the callback method in your controller)
|
||||
- Click "Save".
|
||||
- Click the "Edit" button to edit the details of the "Sign In With Apple"
|
||||
configuration we just created.
|
||||
- If you haven't verified the domain yet, download the verification file,
|
||||
upload it to https://example.com/.well-known/apple-developer-domain-association.txt, and then click the "Verify"
|
||||
button.
|
||||
3. Create a `Private Key` for your website (https://developer.apple.com/account/resources/authkeys/list) with the following details:
|
||||
- Key Name:
|
||||
- Check "Sign In With Apple"
|
||||
- Configure "Sign In With Apple":
|
||||
- Primary App ID: (select the primary app id created in step 1)
|
||||
- Click "Save"
|
||||
- Click "Continue"
|
||||
- Click "Register"
|
||||
- Click "Download"
|
||||
- Rename the downloaded file to `key.txt`
|
||||
4. Create your app's client secret:
|
||||
- Install the JWT Gem:
|
||||
```sh
|
||||
sudo gem install jwt
|
||||
```
|
||||
|
||||
- Create a file called `client_secret.rb` to process the private key:
|
||||
```ruby
|
||||
require 'jwt'
|
||||
|
||||
key_file = 'key.txt'
|
||||
team_id = ''
|
||||
client_id = ''
|
||||
key_id = ''
|
||||
|
||||
ecdsa_key = OpenSSL::PKey::EC.new IO.read key_file
|
||||
|
||||
headers = {
|
||||
'kid' => key_id
|
||||
}
|
||||
|
||||
claims = {
|
||||
'iss' => team_id,
|
||||
'iat' => Time.now.to_i,
|
||||
'exp' => Time.now.to_i + 86400*180,
|
||||
'aud' => 'https://appleid.apple.com',
|
||||
'sub' => client_id,
|
||||
}
|
||||
|
||||
token = JWT.encode claims, ecdsa_key, 'ES256', headers
|
||||
|
||||
puts token
|
||||
```
|
||||
|
||||
- Fill in the following fields:
|
||||
- `team_id`: This can be found on the top-right corner when logged into
|
||||
your Apple Developer account, right under your name.
|
||||
- `client_id`: This is the identifier from the Service Id created in step
|
||||
2 above, for example com.example.service
|
||||
- `key_id`: This is the identifier of the private key created in step 3
|
||||
above.
|
||||
- Save the file and run it from the terminal. It will spit out a JWT which is
|
||||
your client secret, which you will need to add to your `.env` file in the
|
||||
next step.
|
||||
```sh
|
||||
ruby client_secret.rb
|
||||
```
|
||||
|
||||
5. Set the necessary environment variables in your `.env` file:
|
||||
|
||||
```env
|
||||
SIGN_IN_WITH_APPLE_LOGIN="/apple/login/controller/login/action"
|
||||
SIGN_IN_WITH_APPLE_REDIRECT="/apple/login/controller/callback/action"
|
||||
SIGN_IN_WITH_APPLE_CLIENT_ID="your app's service id as registered with Apple"
|
||||
SIGN_IN_WITH_APPLE_CLIENT_SECRET="your app's client secret as calculated in step 4"
|
||||
```
|
||||
|
||||
<a name="Implementation"></a>
|
||||
## Implementation
|
||||
|
||||
<a name="LoginButton"></a>
|
||||
### Button
|
||||
|
||||
Add the following blade directive to your login page:
|
||||
|
||||
```php
|
||||
@signInWithApple($color, $hasBorder, $type, $borderRadius)
|
||||
```
|
||||
|
||||
| Parameter | Definition |
|
||||
| --------- | ---------- |
|
||||
| $color | String, either "black" or "white. |
|
||||
| $hasBorder | Boolean, either `true` or `false`. |
|
||||
| $type | String, either `"sign-in"` or `"continue"`. |
|
||||
| $borderRadius | Integer, greater or equal to 0. |
|
||||
|
||||
<a name="Controller"></a>
|
||||
### Controller
|
||||
|
||||
This implementation uses Socialite to get the login credentials. The following is an example implementation of the controller:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use GeneaLabs\LaravelSocialiter\Facades\Socialiter;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
||||
class AppleSigninController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
return Socialite::driver("sign-in-with-apple")
|
||||
->scopes(["name", "email"])
|
||||
->redirect();
|
||||
}
|
||||
|
||||
public function callback(Request $request)
|
||||
{
|
||||
// get abstract user object, not persisted
|
||||
$user = Socialite::driver("sign-in-with-apple")
|
||||
->user();
|
||||
|
||||
// or use Socialiter to automatically manage user resolution and persistence
|
||||
$user = Socialiter::driver("sign-in-with-apple")
|
||||
->login();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that when processing the returned `$user` object, it is critical to know that the `sub` element is the unique identifier for the user, **NOT** the email address. For more details, visit https://developer.apple.com/documentation/signinwithapplerestapi/authenticating_users_with_sign_in_with_apple.
|
||||
|
||||
----------
|
||||
|
||||
#### Credits
|
||||
1. https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple
|
||||
2. https://developer.apple.com/sign-in-with-apple/get-started
|
||||
|
||||
----------
|
||||
|
||||
## Commitment to Quality
|
||||
During package development I try as best as possible to embrace good design and development practices, to help ensure that this package is as good as it can
|
||||
be. My checklist for package development includes:
|
||||
|
||||
- ✅ Achieve as close to 100% code coverage as possible using unit tests.
|
||||
- ✅ Eliminate any issues identified by SensioLabs Insight and Scrutinizer.
|
||||
- ✅ Be fully PSR1, PSR2, and PSR4 compliant.
|
||||
- ✅ Include comprehensive documentation in README.md.
|
||||
- ✅ Provide an up-to-date CHANGELOG.md which adheres to the format outlined
|
||||
at <http://keepachangelog.com>.
|
||||
- ✅ Have no PHPMD or PHPCS warnings throughout all code.
|
||||
|
||||
## Contributing
|
||||
Please observe and respect all aspects of the included [Code of Conduct](https://github.com/GeneaLabs/laravel-sign-in-with-apple/blob/master/CODE_OF_CONDUCT.md).
|
||||
|
||||
### Reporting Issues
|
||||
When reporting issues, please fill out the included template as completely as
|
||||
possible. Incomplete issues may be ignored or closed if there is not enough
|
||||
information included to be actionable.
|
||||
|
||||
### Submitting Pull Requests
|
||||
Please review the [Contribution Guidelines](https://github.com/GeneaLabs/laravel-sign-in-with-apple/blob/master/CONTRIBUTING.md). Only PRs that meet all criterium will be accepted.
|
||||
|
||||
## If you ❤️ open-source software, give the repos you use a ⭐️.
|
||||
We have included the awesome `symfony/thanks` composer package as a dev dependency. Let your OS package maintainers know you appreciate them by starring the packages you use. Simply run `composer thanks` after installing this package. (And not to worry, since it's a dev-dependency it won't be installed in your live environment.)
|
||||
54
vendor/genealabs/laravel-sign-in-with-apple/composer.json
vendored
Normal file
54
vendor/genealabs/laravel-sign-in-with-apple/composer.json
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "genealabs/laravel-sign-in-with-apple",
|
||||
"description": "Add Apple's new single-signon feature to your site with ease.",
|
||||
"type": "library",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mike Bronner",
|
||||
"email": "hello@genealabs.com",
|
||||
"homepage": "https://genealabs.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"readme": "README.md",
|
||||
"suggest": {
|
||||
"genealabs/laravel-socialiter": "Automatic user resolution and persistence for any Laravel Socialite driver."
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"illuminate/support": "^9.0",
|
||||
"laravel/socialite": "^5.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench-browser-kit": "^7.0",
|
||||
"orchestra/testbench-dusk": "^7.0",
|
||||
"orchestra/testbench": "^7.0",
|
||||
"predis/predis": "^1.1",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GeneaLabs\\LaravelSignInWithApple\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"GeneaLabs\\LaravelSignInWithApple\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"\\GeneaLabs\\LaravelSignInWithApple\\Providers\\ServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
10
vendor/genealabs/laravel-sign-in-with-apple/config/services.php
vendored
Normal file
10
vendor/genealabs/laravel-sign-in-with-apple/config/services.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
"sign_in_with_apple" => [
|
||||
"login" => env("SIGN_IN_WITH_APPLE_LOGIN"),
|
||||
"redirect" => env("SIGN_IN_WITH_APPLE_REDIRECT"),
|
||||
"client_id" => env("SIGN_IN_WITH_APPLE_CLIENT_ID"),
|
||||
"client_secret" => env("SIGN_IN_WITH_APPLE_CLIENT_SECRET"),
|
||||
],
|
||||
];
|
||||
11
vendor/genealabs/laravel-sign-in-with-apple/phpcs.xml
vendored
Normal file
11
vendor/genealabs/laravel-sign-in-with-apple/phpcs.xml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
|
||||
<description>GeneaLabs coding standards.</description>
|
||||
|
||||
<rule ref="PSR1"></rule>
|
||||
<rule ref="PSR2"></rule>
|
||||
<rule ref="PSR12">
|
||||
<exclude name="PSR12.Classes.ClassInstantiation.MissingParentheses"/>
|
||||
<exclude name="PSR12.Functions.ReturnTypeDeclaration.SpaceBeforeColon"/>
|
||||
</rule>
|
||||
</ruleset>
|
||||
46
vendor/genealabs/laravel-sign-in-with-apple/phpunit.xml.dist
vendored
Normal file
46
vendor/genealabs/laravel-sign-in-with-apple/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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="true"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
>
|
||||
<coverage processUncoveredFiles="false">
|
||||
<include>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Browser">
|
||||
<directory suffix="Test.php">./tests/Browser</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_KEY" value="base64:Xgs1LQt1GdVHhD6qyYCXnyq61DE3UKqJ5k2SJc+Nw2g="/>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="APP_URL" value="http://localhost"/>
|
||||
<env name="CACHE_DRIVER" value="redis"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_DRIVER" value="sync"/>
|
||||
<env name="DB_CONNECTION" value="sqlite"/>
|
||||
<env name="DB_DATABASE" value=":memory:"/>
|
||||
<env name="REDIS_HOST" value="127.0.0.1"/>
|
||||
<env name="SIGN_IN_WITH_APPLE_LOGIN" value="/siwa-login"/>
|
||||
<env name="SIGN_IN_WITH_APPLE_REDIRECT" value="http://testing.dev/siwa-callback"/>
|
||||
<env name="SIGN_IN_WITH_APPLE_CLIENT_ID" value="add-your-own"/>
|
||||
<env name="SIGN_IN_WITH_APPLE_CLIENT_SECRET" value="add-your-own"/>
|
||||
</php>
|
||||
</phpunit>
|
||||
83
vendor/genealabs/laravel-sign-in-with-apple/src/Providers/ServiceProvider.php
vendored
Normal file
83
vendor/genealabs/laravel-sign-in-with-apple/src/Providers/ServiceProvider.php
vendored
Normal file
File diff suppressed because one or more lines are too long
123
vendor/genealabs/laravel-sign-in-with-apple/src/Providers/SignInWithAppleProvider.php
vendored
Normal file
123
vendor/genealabs/laravel-sign-in-with-apple/src/Providers/SignInWithAppleProvider.php
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Providers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Laravel\Socialite\Two\AbstractProvider;
|
||||
use Laravel\Socialite\Two\InvalidStateException;
|
||||
use Laravel\Socialite\Two\ProviderInterface;
|
||||
use Laravel\Socialite\Two\User;
|
||||
|
||||
class SignInWithAppleProvider extends AbstractProvider implements ProviderInterface
|
||||
{
|
||||
protected $encodingType = PHP_QUERY_RFC3986;
|
||||
protected $scopeSeparator = " ";
|
||||
|
||||
protected function getAuthUrl($state)
|
||||
{
|
||||
return $this->buildAuthUrlFromBase(
|
||||
'https://appleid.apple.com/auth/authorize',
|
||||
$state
|
||||
);
|
||||
}
|
||||
|
||||
protected function getCodeFields($state = null)
|
||||
{
|
||||
$fields = [
|
||||
'client_id' => $this->clientId,
|
||||
'redirect_uri' => $this->redirectUrl,
|
||||
'scope' => $this->formatScopes($this->getScopes(), $this->scopeSeparator),
|
||||
'response_type' => 'code',
|
||||
'response_mode' => 'form_post',
|
||||
];
|
||||
|
||||
if ($this->usesState()) {
|
||||
$fields['state'] = $state;
|
||||
}
|
||||
|
||||
return array_merge($fields, $this->parameters);
|
||||
}
|
||||
|
||||
protected function getTokenUrl()
|
||||
{
|
||||
return "https://appleid.apple.com/auth/token";
|
||||
}
|
||||
|
||||
public function getAccessToken($code)
|
||||
{
|
||||
$response = $this->getHttpClient()
|
||||
->post(
|
||||
$this->getTokenUrl(),
|
||||
[
|
||||
'headers' => [
|
||||
'Authorization' => 'Basic '. base64_encode(
|
||||
$this->clientId . ':' . $this->clientSecret
|
||||
),
|
||||
],
|
||||
'body' => $this->getTokenFields($code),
|
||||
]
|
||||
);
|
||||
|
||||
return $this->parseAccessToken($response->getBody());
|
||||
}
|
||||
|
||||
protected function parseAccessToken($response)
|
||||
{
|
||||
$data = $response->json();
|
||||
|
||||
return $data['access_token'];
|
||||
}
|
||||
|
||||
protected function getTokenFields($code)
|
||||
{
|
||||
$fields = parent::getTokenFields($code);
|
||||
$fields["grant_type"] = "authorization_code";
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
protected function getUserByToken($token)
|
||||
{
|
||||
$claims = explode('.', $token)[1];
|
||||
|
||||
return json_decode(base64_decode($claims), true);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
$response = $this->getAccessTokenResponse($this->getCode());
|
||||
|
||||
$user = $this->mapUserToObject($this->getUserByToken(
|
||||
Arr::get($response, 'id_token')
|
||||
));
|
||||
|
||||
return $user
|
||||
->setToken(Arr::get($response, 'id_token'))
|
||||
->setRefreshToken(Arr::get($response, 'refresh_token'))
|
||||
->setExpiresIn(Arr::get($response, 'expires_in'));
|
||||
}
|
||||
|
||||
protected function mapUserToObject(array $user)
|
||||
{
|
||||
if (request()->filled("user")) {
|
||||
$userRequest = json_decode(request("user"), true);
|
||||
|
||||
if (array_key_exists("name", $userRequest)) {
|
||||
$user["name"] = $userRequest["name"];
|
||||
$fullName = trim(
|
||||
($user["name"]['firstName'] ?? "")
|
||||
. " "
|
||||
. ($user["name"]['lastName'] ?? "")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return (new User)
|
||||
->setRaw($user)
|
||||
->map([
|
||||
"id" => $user["sub"],
|
||||
"name" => $fullName ?? null,
|
||||
"email" => $user["email"] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
28
vendor/genealabs/laravel-sign-in-with-apple/tests/Browser/SignInWithAppleTest.php
vendored
Normal file
28
vendor/genealabs/laravel-sign-in-with-apple/tests/Browser/SignInWithAppleTest.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests\Browser;
|
||||
|
||||
use GeneaLabs\LaravelSignInWithApple\Tests\BrowserTestCase;
|
||||
use Laravel\Dusk\Browser;
|
||||
|
||||
class SignInWithAppleTest extends BrowserTestCase
|
||||
{
|
||||
public function testButtonIsRendered()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser
|
||||
->visit("/tests")
|
||||
->assertSee("Sign in with Apple");
|
||||
});
|
||||
}
|
||||
|
||||
public function testRedirectShowsAppleIdLogin()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser
|
||||
->visit("/tests")
|
||||
->click('#sign-in-with-apple')
|
||||
->assertSee("Use your Apple ID to sign in to Test Service ID.");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"level": "SEVERE",
|
||||
"message": "http:\/\/127.0.0.1:8000\/favicon.ico - Failed to load resource: the server responded with a status of 404 (Not Found)",
|
||||
"source": "network",
|
||||
"timestamp": 1583082983760
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"level": "WARNING",
|
||||
"message": "https:\/\/appleid.cdn-apple.com\/appleauth\/static\/jsj\/2086116106\/profile\/app.js 254 Mixed Content: The page at 'https:\/\/appleid.apple.com\/auth\/authorize?client_id=dev.test.service-id&redirect_uri=http%3A%2F%2Ftesting.dev%2Fsiwa-callback&scope=name%20email&response_type=code&response_mode=form_post&state=DCCb1UiYHkFyhepDPSMCvHorrEQPIfQL4vD7dMZl' was loaded over a secure connection, but contains a form that targets an insecure endpoint 'http:\/\/testing.dev\/siwa-callback'. This endpoint should be made available over a secure connection.",
|
||||
"source": "security",
|
||||
"timestamp": 1583082984883
|
||||
}
|
||||
]
|
||||
10
vendor/genealabs/laravel-sign-in-with-apple/tests/BrowserTestCase.php
vendored
Normal file
10
vendor/genealabs/laravel-sign-in-with-apple/tests/BrowserTestCase.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests;
|
||||
|
||||
use Orchestra\Testbench\Dusk\TestCase;
|
||||
|
||||
abstract class BrowserTestCase extends TestCase
|
||||
{
|
||||
use CreatesApplication;
|
||||
}
|
||||
42
vendor/genealabs/laravel-sign-in-with-apple/tests/CreatesApplication.php
vendored
Normal file
42
vendor/genealabs/laravel-sign-in-with-apple/tests/CreatesApplication.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests;
|
||||
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Orchestra\Testbench\Dusk\Options;
|
||||
use Illuminate\Session\Middleware\StartSession;
|
||||
use Laravel\Socialite\SocialiteServiceProvider;
|
||||
use GeneaLabs\LaravelSignInWithApple\Providers\ServiceProvider;
|
||||
use GeneaLabs\LaravelSignInWithApple\Tests\Fixtures\Providers\TestingServiceProvider;
|
||||
|
||||
trait CreatesApplication
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
Options::withUI();
|
||||
$this->artisan("view:clear");
|
||||
$this->artisan("cache:clear");
|
||||
$this->artisan("config:clear");
|
||||
}
|
||||
|
||||
protected function getEnvironmentSetUp($app)
|
||||
{
|
||||
$app['config']->set('database.redis.client', "predis");
|
||||
$app->make(Kernel::class)
|
||||
->pushMiddleware(StartSession::class);
|
||||
|
||||
$app->make("view")
|
||||
->addLocation(__DIR__ . "/Fixtures/resources/views");
|
||||
}
|
||||
|
||||
protected function getPackageProviders($app)
|
||||
{
|
||||
return [
|
||||
SocialiteServiceProvider::class,
|
||||
ServiceProvider::class,
|
||||
TestingServiceProvider::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
12
vendor/genealabs/laravel-sign-in-with-apple/tests/FeatureTestCase.php
vendored
Normal file
12
vendor/genealabs/laravel-sign-in-with-apple/tests/FeatureTestCase.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests;
|
||||
|
||||
use Orchestra\Testbench\BrowserKit\TestCase;
|
||||
|
||||
abstract class FeatureTestCase extends TestCase
|
||||
{
|
||||
use CreatesApplication;
|
||||
|
||||
public $baseUrl = 'http://testing.dev';
|
||||
}
|
||||
21
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/Http/Controllers/SiwaController.php
vendored
Normal file
21
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/Http/Controllers/SiwaController.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests\Fixtures\Http\Controllers;
|
||||
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
||||
class SiwaController
|
||||
{
|
||||
public function login()
|
||||
{
|
||||
return Socialite::driver("sign-in-with-apple")
|
||||
->scopes(["name", "email"])
|
||||
->redirect();
|
||||
}
|
||||
|
||||
public function callback()
|
||||
{
|
||||
$user = Socialite::driver("sign-in-with-apple")
|
||||
->user();
|
||||
}
|
||||
}
|
||||
20
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/Providers/TestingServiceProvider.php
vendored
Normal file
20
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/Providers/TestingServiceProvider.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests\Fixtures\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class TestingServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $defer = false;
|
||||
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . "/../routes/web.php");
|
||||
}
|
||||
}
|
||||
10
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/resources/views/tests.blade.php
vendored
Normal file
10
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/resources/views/tests.blade.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<! DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
@signInWithApple("black", false, "sign-in", 6)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
7
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/routes/web.php
vendored
Normal file
7
vendor/genealabs/laravel-sign-in-with-apple/tests/Fixtures/routes/web.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use GeneaLabs\LaravelSignInWithApple\Tests\Fixtures\Http\Controllers\SiwaController;
|
||||
|
||||
Route::view("/tests", "tests");
|
||||
Route::get("/siwa-login", SiwaController::class . "@login");
|
||||
Route::post("/siwa-callback", SiwaController::class . "@callback");
|
||||
10
vendor/genealabs/laravel-sign-in-with-apple/tests/UnitTestCase.php
vendored
Normal file
10
vendor/genealabs/laravel-sign-in-with-apple/tests/UnitTestCase.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace GeneaLabs\LaravelSignInWithApple\Tests;
|
||||
|
||||
use Orchestra\Testbench\TestCase;
|
||||
|
||||
abstract class UnitTestCase extends TestCase
|
||||
{
|
||||
use CreatesApplication;
|
||||
}
|
||||
Reference in New Issue
Block a user