-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
348 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.php export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
### https://raw.github.com/github/gitignore/da00310ccba9de9a988cc973ef5238ad2c1460e9/Global/Vim.gitignore | ||
|
||
[._]*.s[a-w][a-z] | ||
[._]s[a-w][a-z] | ||
*.un~ | ||
Session.vim | ||
.netrwhist | ||
*~ | ||
|
||
|
||
### https://raw.github.com/github/gitignore/da00310ccba9de9a988cc973ef5238ad2c1460e9/Composer.gitignore | ||
|
||
composer.phar | ||
vendor/ | ||
|
||
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file | ||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file | ||
composer.lock | ||
|
||
|
||
### https://raw.github.com/github/gitignore/da00310ccba9de9a988cc973ef5238ad2c1460e9/Global/Linux.gitignore | ||
|
||
*~ | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
filter: | ||
paths: ["src/*"] | ||
tools: | ||
external_code_coverage: true | ||
php_code_coverage: true | ||
php_sim: true | ||
php_mess_detector: true | ||
php_pdepend: true | ||
php_analyzer: true | ||
php_cpd: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: php | ||
php: | ||
- 5.6 | ||
- hhvm | ||
- 7 | ||
before_script: | ||
- composer self-update | ||
- composer install --prefer-source | ||
script: | ||
- phpunit --coverage-clover=coverage.clover | ||
after_script: | ||
- wget https://scrutinizer-ci.com/ocular.phar | ||
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016, Jake Johns | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# fusible.auth-provider | ||
Canned [Aura\Auth] configuration for [Aura\Di (3.x)] | ||
|
||
[![Latest version][ico-version]][link-packagist] | ||
[![Build Status][ico-travis]][link-travis] | ||
[![Coverage Status][ico-scrutinizer]][link-scrutinizer] | ||
[![Quality Score][ico-code-quality]][link-code-quality] | ||
|
||
## Installation | ||
``` | ||
composer require fusible/auth-provider | ||
``` | ||
|
||
## Usage | ||
|
||
### [Aura\Di (3.x)] | ||
See: [ Aura\Di > *Container Builder and Config Classes* ][Aura\Di docs]. | ||
```php | ||
use Aura\Di\ContainerBuilder; | ||
|
||
$builder = new ContainerBuilder(); | ||
$di = $builder->newConfiguredInstance(['Fusible\AuthProvider\Config']); | ||
``` | ||
|
||
### [Radar.Project] | ||
See: [ Radar.Project > Container Configuration > *Configuration (aka "Providers")* ][Radar.Project docs]. | ||
```php | ||
use Radar\Adr\Boot; | ||
|
||
$boot = new Boot(); | ||
$adr = $boot->adr(['Fusible\Auth\Config']); | ||
``` | ||
|
||
|
||
[Aura\Auth]: https://github.com/auraphp/Aura.Auth | ||
[Aura\Di (3.x)]: https://github.com/auraphp/Aura.Di/tree/3.x | ||
[Radar.Project]: https://github.com/radarphp/Radar.Project | ||
[Aura\Di docs]: https://github.com/auraphp/Aura.Di/blob/3.x/docs/config.md | ||
[Radar.Project docs]: https://github.com/radarphp/Radar.Project/blob/1.x/docs/container.md#configuration-aka-providers | ||
|
||
[ico-version]: https://img.shields.io/packagist/v/fusible/auth-provider.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/fusible/fusible.auth-provider/develop.svg?style=flat-square | ||
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/fusible/fusible.auth-provider.svg?style=flat-square | ||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/fusible/fusible.auth-provider.svg?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/fusible/auth-provider | ||
[link-travis]: https://travis-ci.org/fusible/fusible.auth-provider | ||
[link-scrutinizer]: https://scrutinizer-ci.com/g/fusible/fusible.auth-provider | ||
[link-code-quality]: https://scrutinizer-ci.com/g/fusible/fusible.auth-provider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "fusible/auth-provider", | ||
"description": "Aura\\Auth provider for Aura\\Di", | ||
"homepage":"https://github.com/fusible/fusible.auth-provider", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "jake johns", | ||
"email": "jake@jakejohns.net" | ||
} | ||
], | ||
"require": { | ||
"aura/di": "~3.0", | ||
"aura/auth": "^2.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Fusible\\AuthProvider\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Fusible\\AuthProvider\\":"tests/", | ||
"Aura\\Di\\": "vendor/aura/di/tests/" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
// @codingStandardsIgnoreFile | ||
error_reporting(E_ALL); | ||
$autoloader = __DIR__ . '/vendor/autoload.php'; | ||
if (! file_exists($autoloader)) { | ||
echo "Composer autoloader not found: $autoloader" . PHP_EOL; | ||
echo "Please issue 'composer install' and try again." . PHP_EOL; | ||
exit(1); | ||
} | ||
require $autoloader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<phpunit bootstrap="./phpunit.php"> | ||
<testsuites> | ||
<testsuite> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
/** | ||
* Aura\Auth Provider for Aura\Di | ||
* | ||
* PHP version 5 | ||
* | ||
* Copyright (C) 2016 Jake Johns | ||
* | ||
* This software may be modified and distributed under the terms | ||
* of the MIT license. See the LICENSE file for details. | ||
* | ||
* @category Config | ||
* @package Fusible\AuthProvider | ||
* @author Jake Johns <jake@jakejohns.net> | ||
* @copyright 2016 Jake Johns | ||
* @license http://jnj.mit-license.org/2016 MIT License | ||
* @link https://github.com/fusible/fusible.auth-provider | ||
*/ | ||
|
||
namespace Fusible\AuthProvider; | ||
|
||
use Aura\Di\Container; | ||
use Aura\Di\ContainerConfig; | ||
|
||
/** | ||
* Config | ||
* | ||
* @category Config | ||
* @package Fusible\AuthProvider | ||
* @author Jake Johns <jake@jakejohns.net> | ||
* @license http://jnj.mit-license.org/2016 MIT License | ||
* @link https://github.com/fusible/fusible.auth-provider | ||
* | ||
* @see ContainerConfig | ||
*/ | ||
class Config extends ContainerConfig | ||
{ | ||
/** | ||
* Cookie | ||
* | ||
* @var array | ||
* | ||
* @access protected | ||
*/ | ||
protected $cookie; | ||
|
||
/** | ||
* __construct | ||
* | ||
* @param array $cookie Cookie array | ||
* | ||
* @access public | ||
*/ | ||
public function __construct(array $cookie = null) | ||
{ | ||
$this->cookie = (null === $cookie) ? $_COOKIE : $cookie; | ||
} | ||
|
||
/** | ||
* Define Aura\Auth factories and services | ||
* | ||
* @param Container $di DI Container | ||
* | ||
* @return void | ||
* | ||
* @access public | ||
* | ||
* @SuppressWarnings(PHPMD.ShortVariable) | ||
*/ | ||
public function define(Container $di) | ||
{ | ||
if (! isset($di->values['cookie'])) { | ||
$di->values['cookie'] = $this->cookie; | ||
} | ||
|
||
$di->params['Aura\Auth\AuthFactory']['cookie'] = $di->lazyValue('cookie'); | ||
|
||
$di->set( | ||
'aura/auth:factory', | ||
$di->lazyNew('Aura\Auth\AuthFactory') | ||
); | ||
|
||
if (! $di->has('aura/auth:adapter')) { | ||
$di->set( | ||
'aura/auth:adapter', | ||
$di->lazyNew('Aura\Auth\Adapter\NullAdapter') | ||
); | ||
} | ||
|
||
$di->set( | ||
'aura/auth:auth', | ||
$di->lazyGetCall('aura/auth:factory', 'newInstance') | ||
); | ||
|
||
$di->set( | ||
'aura/auth:login', | ||
$di->lazyGetCall( | ||
'aura/auth:factory', | ||
'newLoginService', | ||
$di->lazyGet('aura/auth:adapter') | ||
) | ||
); | ||
|
||
$di->set( | ||
'aura/auth:logout', | ||
$di->lazyGetCall( | ||
'aura/auth:factory', | ||
'newLogoutService', | ||
$di->lazyGet('aura/auth:adapter') | ||
) | ||
); | ||
|
||
$di->set( | ||
'aura/auth:resume', | ||
$di->lazyGetCall( | ||
'aura/auth:factory', | ||
'newResumeService', | ||
$di->lazyGet('aura/auth:adapter') | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
// @codingStandardsIgnoreFile | ||
|
||
namespace Fusible\AuthProvider; | ||
|
||
use Aura\Di\AbstractContainerConfigTest; | ||
|
||
class ConfigTest extends AbstractContainerConfigTest | ||
{ | ||
protected function setUp() | ||
{ | ||
@session_start(); | ||
parent::setUp(); | ||
} | ||
|
||
protected function getConfigClasses() | ||
{ | ||
return [ | ||
'Fusible\AuthProvider\Config' | ||
]; | ||
} | ||
|
||
public function provideGet() | ||
{ | ||
return [ | ||
[ 'aura/auth:factory', 'Aura\Auth\AuthFactory' ], | ||
[ 'aura/auth:adapter', 'Aura\Auth\Adapter\NullAdapter' ], | ||
[ 'aura/auth:auth', 'Aura\Auth\Auth' ], | ||
[ 'aura/auth:login', 'Aura\Auth\Service\LoginService' ], | ||
[ 'aura/auth:logout', 'Aura\Auth\Service\LogoutService'], | ||
[ 'aura/auth:resume', 'Aura\Auth\Service\ResumeService'] | ||
]; | ||
} | ||
|
||
public function provideNewInstance() | ||
{ | ||
return [ | ||
['Aura\Auth\AuthFactory'] | ||
]; | ||
} | ||
|
||
} | ||
|