diff --git a/composer.json b/composer.json index f07c3d542e..23df9b4c37 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "api-clients/transport": "^3.1", "api-clients/travis": "^1.0", "kelunik/link-header-rfc5988": "^1.0", + "lcobucci/jwt": "^3.3", "react/promise-stream": "^1.0 || ^0.1.1", "wyrihaximus/react-stream-base64": "^1.0", "wyrihaximus/react-stream-json": "^1.0" diff --git a/composer.lock b/composer.lock index f73138643b..0a296ccdd7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0aa201ed830ddbac23d62bf36b341655", + "content-hash": "542ab83627e9a560eebe02f8b22c7459", "packages": [ { "name": "api-clients/appveyor", @@ -1127,6 +1127,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", "time": "2017-02-14T19:40:03+00:00" }, { @@ -1626,6 +1627,7 @@ "serialize", "tokenizer" ], + "abandoned": "opis/closure", "time": "2018-03-21T22:21:57+00:00" }, { @@ -1717,6 +1719,61 @@ "description": "RFC 5988 compatible link header parser.", "time": "2017-09-16T16:48:40+00:00" }, + { + "name": "lcobucci/jwt", + "version": "3.3.1", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "a11ec5f4b4d75d1fcd04e133dede4c317aac9e18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/a11ec5f4b4d75d1fcd04e133dede4c317aac9e18", + "reference": "a11ec5f4b4d75d1fcd04e133dede4c317aac9e18", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-openssl": "*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "^5.7 || ^7.3", + "squizlabs/php_codesniffer": "~2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "time": "2019-05-24T18:30:49+00:00" + }, { "name": "league/tactician", "version": "v1.0.3", @@ -3636,6 +3693,7 @@ "hydrator", "zf" ], + "abandoned": "laminas/laminas-hydrator", "time": "2018-11-19T19:16:10+00:00" }, { @@ -3682,6 +3740,7 @@ "stdlib", "zf" ], + "abandoned": "laminas/laminas-stdlib", "time": "2018-08-28T21:34:05+00:00" } ], diff --git a/src/Authentication/JWT.php b/src/Authentication/JWT.php new file mode 100644 index 0000000000..28efb0bbd5 --- /dev/null +++ b/src/Authentication/JWT.php @@ -0,0 +1,39 @@ +token = $token; + } + + public function getOptions(): array + { + return [ + FoundationOptions::TRANSPORT_OPTIONS => [ + TransportOptions::MIDDLEWARE => [ + BearerAuthorizationHeaderMiddleware::class, + ], + TransportOptions::DEFAULT_REQUEST_OPTIONS => [ + BearerAuthorizationHeaderMiddleware::class => [ + BearerAuthorizationHeaderMiddlewareOptions::TOKEN => $this->token, + ], + ], + ], + ]; + } +}