diff --git a/.editorconfig b/.editorconfig old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 index 6e63bf6..101bbb7 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,10 @@ language: php php: - '5.6' - '7.0' - - hhvm + - '7.1' + - '7.2' install: - - composer install + - composer update script: phpunit --verbose --debug --bootstrap tests/bootstrap.php tests diff --git a/README.md b/README.md old mode 100644 new mode 100755 index c27f22b..b929ab2 --- a/README.md +++ b/README.md @@ -70,6 +70,52 @@ return [ ]; ``` +**NOTE : As of version 1.6.0 you can directly put your configuration into your component. For example:** + +```php +urlManager; +$spBaseUrl = $urlManager->getHostInfo() . $urlManager->getBaseUrl(); + +$config = [ + // some other configuration here + + 'components' => [ + 'saml' => [ + 'class' => 'asasmoyo\yii2saml\Saml', + 'config' => [ + 'sp' => [ + 'entityId' => $spBaseUrl.'/saml/metadata', + 'assertionConsumerService' => [ + 'url' => $spBaseUrl.'/saml/acs', + ], + 'singleLogoutService' => [ + 'url' => $spBaseUrl.'/saml/sls', + ], + 'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified', + ], + 'idp' => [ + 'entityId' => 'identity-provider', + 'singleSignOnService' => [ + 'url' => 'https://idp.com/sso', + ], + 'singleLogoutService' => [ + 'url' => 'https://idp.com/sls', + ], + 'x509cert' => '', + ], + ]; + ] + ], + + // some other configuration here +]; + +return $config; + +``` + Usage ----- @@ -207,7 +253,7 @@ Usage ----- If the SAMLResponse is rejected, add to the SAML settings the parameter -``` +``` 'debug' => true, ``` and the reason will be prompted. diff --git a/composer.json b/composer.json old mode 100644 new mode 100755 index 9e59e0b..5058e66 --- a/composer.json +++ b/composer.json @@ -13,16 +13,23 @@ { "name": "Arba Sasmoyo", "email": "asasmoyo@student.uns.ac.id" + }, + { + "name": "Muhammad Safri Juliardi", + "email": "ardi93@gmail.com" } ], "minimum-stability": "dev", "prefer-stable": true, "require": { - "yiisoft/yii2": "*", - "onelogin/php-saml": "~2.13.0" + "yiisoft/yii2": ">=2.0.13", + "onelogin/php-saml": "~3.0.0" }, "require-dev": { - "phpunit/phpunit": "5.1.*" + "phpunit/phpunit": "5.0.*" + }, + "conflict": { + "phpunit/php-timer": ">=2" }, "autoload": { "psr-4": { @@ -34,4 +41,4 @@ "asminog\\yii2saml\\tests\\": "tests/" } } -} +} \ No newline at end of file diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 index 88ec056..22c763a --- a/composer.lock +++ b/composer.lock @@ -1,88 +1,102 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "dd994765e99464e5101e237690f072b2", - "content-hash": "fea1a7d58941589d63f8715bcc5df57c", + "content-hash": "425c820827ce1fd88d7903d474cbd90b", "packages": [ { - "name": "bower-asset/jquery", - "version": "2.2.4", + "name": "bower-asset/inputmask", + "version": "3.3.11", "source": { "type": "git", - "url": "https://github.com/jquery/jquery-dist.git", - "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72" + "url": "https://github.com/RobinHerbots/Inputmask.git", + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/c0185ab7c75aab88762c5aae780b9d83b80eda72", - "reference": "c0185ab7c75aab88762c5aae780b9d83b80eda72", + "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b", + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b", "shasum": "" }, + "require": { + "bower-asset/jquery": ">=1.7" + }, "type": "bower-asset-library", "extra": { - "bower-asset-main": "dist/jquery.js", + "bower-asset-main": [ + "./dist/inputmask/inputmask.js", + "./dist/inputmask/inputmask.extensions.js", + "./dist/inputmask/inputmask.date.extensions.js", + "./dist/inputmask/inputmask.numeric.extensions.js", + "./dist/inputmask/inputmask.phone.extensions.js", + "./dist/inputmask/jquery.inputmask.js", + "./dist/inputmask/global/document.js", + "./dist/inputmask/global/window.js", + "./dist/inputmask/phone-codes/phone.js", + "./dist/inputmask/phone-codes/phone-be.js", + "./dist/inputmask/phone-codes/phone-nl.js", + "./dist/inputmask/phone-codes/phone-ru.js", + "./dist/inputmask/phone-codes/phone-uk.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js", + "./dist/inputmask/dependencyLibs/inputmask.dependencyLib.js", + "./dist/inputmask/bindings/inputmask.binding.js" + ], "bower-asset-ignore": [ - "package.json" + "**/*", + "!dist/*", + "!dist/inputmask/*", + "!dist/min/*", + "!dist/min/inputmask/*" ] }, "license": [ - "MIT" + "http://opensource.org/licenses/mit-license.php" ], + "description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.", "keywords": [ - "browser", - "javascript", + "form", + "input", + "inputmask", "jquery", - "library" - ] + "mask", + "plugins" + ], + "time": "2017-11-21T11:46:23+00:00" }, { - "name": "bower-asset/jquery.inputmask", - "version": "3.2.7", + "name": "bower-asset/jquery", + "version": "3.2.1", "source": { "type": "git", - "url": "https://github.com/RobinHerbots/jquery.inputmask.git", - "reference": "5a72c563b502b8e05958a524cdfffafe9987be38" + "url": "https://github.com/jquery/jquery-dist.git", + "reference": "77d2a51d0520d2ee44173afdf4e40a9201f5964e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/5a72c563b502b8e05958a524cdfffafe9987be38", - "reference": "5a72c563b502b8e05958a524cdfffafe9987be38", + "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/77d2a51d0520d2ee44173afdf4e40a9201f5964e", + "reference": "77d2a51d0520d2ee44173afdf4e40a9201f5964e", "shasum": "" }, - "require": { - "bower-asset/jquery": ">=1.7" - }, "type": "bower-asset-library", "extra": { - "bower-asset-main": [ - "./dist/inputmask/inputmask.js" - ], + "bower-asset-main": "dist/jquery.js", "bower-asset-ignore": [ - "**/*", - "!dist/*", - "!dist/inputmask/*", - "!dist/min/*", - "!dist/min/inputmask/*", - "!extra/bindings/*", - "!extra/dependencyLibs/*", - "!extra/phone-codes/*" + "package.json" ] }, "license": [ - "http://opensource.org/licenses/mit-license.php" + "MIT" ], - "description": "jquery.inputmask is a jquery plugin which create an input mask.", "keywords": [ - "form", - "input", - "inputmask", + "browser", + "javascript", "jquery", - "mask", - "plugins" - ] + "library" + ], + "time": "2017-03-20T19:02:00+00:00" }, { "name": "bower-asset/punycode", @@ -110,20 +124,21 @@ "node_modules", "package.json" ] - } + }, + "time": "2014-10-22T12:02:42+00:00" }, { "name": "bower-asset/yii2-pjax", - "version": "v2.0.6", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/yiisoft/jquery-pjax.git", - "reference": "60728da6ade5879e807a49ce59ef9a72039b8978" + "reference": "c39f2393883f370d3c0d63d80a122534131b0f56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/60728da6ade5879e807a49ce59ef9a72039b8978", - "reference": "60728da6ade5879e807a49ce59ef9a72039b8978", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/c39f2393883f370d3c0d63d80a122534131b0f56", + "reference": "c39f2393883f370d3c0d63d80a122534131b0f56", "shasum": "" }, "require": { @@ -140,24 +155,28 @@ "vendor/", "script/", "test/" - ] + ], + "branch-alias": { + "dev-master": "2.0.8-dev" + } }, "license": [ "MIT" - ] + ], + "time": "2017-10-14T08:42:41+00:00" }, { "name": "cebe/markdown", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/cebe/markdown.git", - "reference": "c30eb5e01fe021cc5bba2f9ee0eeef96d4931166" + "reference": "25b28bae8a6f185b5030673af77b32e1163d5c6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cebe/markdown/zipball/c30eb5e01fe021cc5bba2f9ee0eeef96d4931166", - "reference": "c30eb5e01fe021cc5bba2f9ee0eeef96d4931166", + "url": "https://api.github.com/repos/cebe/markdown/zipball/25b28bae8a6f185b5030673af77b32e1163d5c6e", + "reference": "25b28bae8a6f185b5030673af77b32e1163d5c6e", "shasum": "" }, "require": { @@ -204,25 +223,28 @@ "markdown", "markdown-extra" ], - "time": "2016-09-14 20:40:20" + "time": "2017-07-16T21:13:23+00:00" }, { "name": "ezyang/htmlpurifier", - "version": "v4.8.0", + "version": "v4.10.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2" + "reference": "d85d39da4576a6934b72480be6978fb10c860021" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2", - "reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021", + "reference": "d85d39da4576a6934b72480be6978fb10c860021", "shasum": "" }, "require": { "php": ">=5.2" }, + "require-dev": { + "simpletest/simpletest": "^1.1" + }, "type": "library", "autoload": { "psr-0": { @@ -248,79 +270,115 @@ "keywords": [ "html" ], - "time": "2016-07-16 12:58:58" + "time": "2018-02-23T01:58:20+00:00" }, { "name": "onelogin/php-saml", - "version": "2.10.1", + "version": "3.0.0.x-dev", "source": { "type": "git", "url": "https://github.com/onelogin/php-saml.git", - "reference": "1017afe7fe6da1def37cc92af37434fbba893d03" + "reference": "a7e0835630fec86ced78f65e4e45ed27d115137e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/onelogin/php-saml/zipball/1017afe7fe6da1def37cc92af37434fbba893d03", - "reference": "1017afe7fe6da1def37cc92af37434fbba893d03", + "url": "https://api.github.com/repos/onelogin/php-saml/zipball/a7e0835630fec86ced78f65e4e45ed27d115137e", + "reference": "a7e0835630fec86ced78f65e4e45ed27d115137e", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-mcrypt": "*", - "ext-openssl": "*", - "php": ">=5.3.2" + "php": ">=5.4", + "robrichards/xmlseclibs": "^3.0" }, "require-dev": { - "pdepend/pdepend": "1.1.0", - "phploc/phploc": "*", - "phpunit/phpunit": "4.8", - "satooshi/php-coveralls": "1.0.1", - "sebastian/phpcpd": "*", - "squizlabs/php_codesniffer": "*" + "pdepend/pdepend": "^2.5.0", + "php-coveralls/php-coveralls": "^1.0.2 || ^2.0", + "phploc/phploc": "^2.1 || ^3.0 || ^4.0", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1", + "sebastian/phpcpd": "^2.0 || ^3.0 || ^4.0", + "squizlabs/php_codesniffer": "^3.1.1" }, "suggest": { + "ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs", "ext-gettext": "Install gettext and php5-gettext libs to handle translations", - "ext-mcrypt": "Install mcrypt and php5-mcrypt libs in order to support encryption", - "lib-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)" + "ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)" }, "type": "library", "autoload": { - "classmap": [ - "extlib/xmlseclibs", - "lib/Saml", - "lib/Saml2" - ] + "psr-4": { + "OneLogin\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "OneLogin PHP SAML Toolkit", - "homepage": "https://onelogin.zendesk.com/hc/en-us/sections/200245634-SAML-Toolkits", + "homepage": "https://developers.onelogin.com/saml/php", "keywords": [ "SAML2", "onelogin", "saml" ], - "time": "2016-10-26 11:31:56" + "time": "2018-09-13T09:23:06+00:00" + }, + { + "name": "robrichards/xmlseclibs", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/robrichards/xmlseclibs.git", + "reference": "d937712f70f93a584eb0299ccd87dc6374003781" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/d937712f70f93a584eb0299ccd87dc6374003781", + "reference": "d937712f70f93a584eb0299ccd87dc6374003781", + "shasum": "" + }, + "require": { + "php": ">= 5.4" + }, + "suggest": { + "ext-openssl": "OpenSSL extension" + }, + "type": "library", + "autoload": { + "psr-4": { + "RobRichards\\XMLSecLibs\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "A PHP library for XML Security", + "homepage": "https://github.com/robrichards/xmlseclibs", + "keywords": [ + "security", + "signature", + "xml", + "xmldsig" + ], + "time": "2017-08-31T09:27:07+00:00" }, { "name": "yiisoft/yii2", - "version": "2.0.10", + "version": "2.0.15.1", "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-framework.git", - "reference": "5bfcb7a6dfa9771e2248eb8c4448613330f343ff" + "reference": "ed3a9e1c4abe206e1c3ce48a6b3624119b79850d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/5bfcb7a6dfa9771e2248eb8c4448613330f343ff", - "reference": "5bfcb7a6dfa9771e2248eb8c4448613330f343ff", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/ed3a9e1c4abe206e1c3ce48a6b3624119b79850d", + "reference": "ed3a9e1c4abe206e1c3ce48a6b3624119b79850d", "shasum": "" }, "require": { - "bower-asset/jquery": "2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", - "bower-asset/jquery.inputmask": "~3.2.2", + "bower-asset/inputmask": "~3.2.2 | ~3.3.5", + "bower-asset/jquery": "3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", "bower-asset/punycode": "1.3.*", "bower-asset/yii2-pjax": "~2.0.1", "cebe/markdown": "~1.0.0 | ~1.1.0", @@ -388,6 +446,12 @@ "name": "Dmitry Naumenko", "email": "d.naumenko.a@gmail.com", "role": "Core framework development" + }, + { + "name": "Boudewijn Vahrmeijer", + "email": "info@dynasource.eu", + "homepage": "http://dynasource.eu", + "role": "Core framework development" } ], "description": "Yii PHP Framework Version 2", @@ -396,25 +460,28 @@ "framework", "yii2" ], - "time": "2016-10-20 12:02:50" + "time": "2018-03-21T18:36:53+00:00" }, { "name": "yiisoft/yii2-composer", - "version": "2.0.4", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-composer.git", - "reference": "7452fd908a5023b8bb5ea1b123a174ca080de464" + "reference": "1439e78be1218c492e6cde251ed87d3f128b9534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/7452fd908a5023b8bb5ea1b123a174ca080de464", - "reference": "7452fd908a5023b8bb5ea1b123a174ca080de464", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/1439e78be1218c492e6cde251ed87d3f128b9534", + "reference": "1439e78be1218c492e6cde251ed87d3f128b9534", "shasum": "" }, "require": { "composer-plugin-api": "^1.0" }, + "require-dev": { + "composer/composer": "^1.0" + }, "type": "composer-plugin", "extra": { "class": "yii\\composer\\Plugin", @@ -435,6 +502,10 @@ { "name": "Qiang Xue", "email": "qiang.xue@gmail.com" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc" } ], "description": "The composer plugin for Yii extension installer", @@ -443,38 +514,38 @@ "extension installer", "yii2" ], - "time": "2016-02-06 00:49:24" + "time": "2018-07-05T15:44:47+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -499,41 +570,47 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.5.4", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f" + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f", - "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", + "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -541,20 +618,20 @@ "object", "object graph" ], - "time": "2016-09-16 13:37:59" + "time": "2018-06-11T23:09:50+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -595,33 +672,39 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -640,24 +723,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30 07:12:33" + "time": "2017-11-30T07:14:17+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443", - "reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^5.5 || ^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { @@ -687,36 +770,37 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-06-10 07:14:17" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.1", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", - "reference": "58a8137754bc24b25740d4281399a4a3596058e0", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0" + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.0" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -749,7 +833,7 @@ "spy", "stub" ], - "time": "2016-06-07 08:13:47" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", @@ -812,20 +896,20 @@ "testing", "xunit" ], - "time": "2016-05-27 16:24:29" + "time": "2016-05-27T16:24:29+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -859,7 +943,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -900,29 +984,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -944,20 +1033,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -993,20 +1082,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "5.1.7", + "version": "5.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26" + "reference": "9104a4e2f6a3ebdc4eb036624949a1a2849373dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26", - "reference": "d0f7ae467dcbe7a6ad050540c9d1d39a7aefff26", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9104a4e2f6a3ebdc4eb036624949a1a2849373dd", + "reference": "9104a4e2f6a3ebdc4eb036624949a1a2849373dd", "shasum": "" }, "require": { @@ -1022,7 +1111,7 @@ "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": ">=3.0.5", + "phpunit/phpunit-mock-objects": ">=3.0", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", @@ -1041,7 +1130,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -1067,7 +1156,7 @@ "testing", "xunit" ], - "time": "2016-02-02 09:03:29" + "time": "2015-11-30T08:33:35+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1123,27 +1212,27 @@ "mock", "xunit" ], - "time": "2016-04-20 14:39:26" + "time": "2016-04-20T14:39:26+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1168,26 +1257,26 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -1232,27 +1321,27 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1284,7 +1373,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -1334,7 +1423,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -1401,7 +1490,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/global-state", @@ -1452,20 +1541,20 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { @@ -1505,7 +1594,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/resource-operations", @@ -1547,7 +1636,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -1582,29 +1671,97 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/yaml", - "version": "v3.1.6", + "version": "v3.4.15", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27" + "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27", - "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c2f4812ead9f847cb69e90917ca7502e6892d6b8", + "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1631,24 +1788,24 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-10-24 18:41:13" + "time": "2018-08-10T07:34:36+00:00" }, { "name": "webmozart/assert", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", - "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { - "php": "^5.3.3|^7.0" + "php": "^5.3.3 || ^7.0" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -1657,7 +1814,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1681,7 +1838,7 @@ "check", "validate" ], - "time": "2016-08-09 15:02:57" + "time": "2018-01-29T19:49:41+00:00" } ], "aliases": [], diff --git a/src/Saml.php b/src/Saml.php old mode 100644 new mode 100755 index dd21d31..3576ffd --- a/src/Saml.php +++ b/src/Saml.php @@ -3,22 +3,26 @@ namespace asminog\yii2saml; use Yii; -use yii\base\Object; +use Exception; +use OneLogin\Saml2\Auth; +use OneLogin\Saml2\Settings; +use yii\base\BaseObject; /** * This class wraps OneLogin_Saml2_Auth class by creating an instance of that class using configurations specified in configFileName variable inside @app/config folder. */ -class Saml extends Object +class Saml extends BaseObject { /** * The file in which contains OneLogin_Saml2_Auth configurations. + * @var string */ public $configFileName = '@app/config/saml.php'; /** * OneLogin_Saml2_Auth instance. - * @var \OneLogin_Saml2_Auth + * @var \OneLogin\Saml2\Auth */ private $instance; @@ -32,13 +36,12 @@ public function init() { parent::init(); - if (!isset($this->config)) { + if (empty($this->config)) { $configFile = Yii::getAlias($this->configFileName); - $this->config = require($configFile); } - $this->instance = new \OneLogin_Saml2_Auth($this->config); + $this->instance = new Auth($this->config); } /** @@ -76,17 +79,17 @@ public function getAttribute($name) /** * Returns the metadata of this Service Provider in xml. * @return string Metadata in xml - * @throws \Exception - * @throws \OneLogin_Saml2_Error + * @throws Exception + * @throws OneLogin\Saml2\Error */ public function getMetadata() { - $samlSettings = new \OneLogin_Saml2_Settings($this->config, true); + $samlSettings = new Settings($this->config, true); $metadata = $samlSettings->getSPMetadata(); $errors = $samlSettings->validateMetadata($metadata); if (!empty($errors)) { - throw new \Exception('Invalid Metadata Service Provider'); + throw new Exception('Invalid Metadata Service Provider'); } return $metadata; @@ -102,7 +105,7 @@ public function processResponse() public function processSLO() { - $this->instance->processSLO(); + $this->instance->processSLO(); } /** diff --git a/src/actions/AcsAction.php b/src/actions/AcsAction.php old mode 100644 new mode 100755 diff --git a/src/actions/BaseAction.php b/src/actions/BaseAction.php old mode 100644 new mode 100755 diff --git a/src/actions/LoginAction.php b/src/actions/LoginAction.php old mode 100644 new mode 100755 diff --git a/src/actions/LogoutAction.php b/src/actions/LogoutAction.php old mode 100644 new mode 100755 diff --git a/src/actions/MetadataAction.php b/src/actions/MetadataAction.php old mode 100644 new mode 100755 diff --git a/src/actions/SlsAction.php b/src/actions/SlsAction.php old mode 100644 new mode 100755 diff --git a/tests/.gitkeep b/tests/.gitkeep old mode 100644 new mode 100755 diff --git a/tests/SamlTest.php b/tests/SamlTest.php old mode 100644 new mode 100755 index ba66a9f..4259ae0 --- a/tests/SamlTest.php +++ b/tests/SamlTest.php @@ -6,11 +6,21 @@ class SamlTest extends \PHPUnit_Framework_TestCase { - public function testCreateInstance() { $instance = new Saml(); $this->assertNotEquals($instance, null); } + public function testConfigFromArray() + { + $config = require __DIR__ . '/config/saml.php'; + + $instance = new Saml([ + 'config' => $config, + ]); + + $this->assertNotEquals($instance->config, []); + $this->assertEquals($instance->config['sp']['entityId'], 'service-provider'); + } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php old mode 100644 new mode 100755 diff --git a/tests/config/saml.php b/tests/config/saml.php old mode 100644 new mode 100755