File tree Expand file tree Collapse file tree 3 files changed +100
-1
lines changed Expand file tree Collapse file tree 3 files changed +100
-1
lines changed Original file line number Diff line number Diff line change 2424 "api-clients/transport" : " ^3.1" ,
2525 "api-clients/travis" : " ^1.0" ,
2626 "kelunik/link-header-rfc5988" : " ^1.0" ,
27+ "lcobucci/jwt" : " ^3.3" ,
2728 "react/promise-stream" : " ^1.0 || ^0.1.1" ,
2829 "wyrihaximus/react-stream-base64" : " ^1.0" ,
2930 "wyrihaximus/react-stream-json" : " ^1.0"
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Authentication ;
4+
5+ use ApiClients \Client \Github \AuthenticationInterface ;
6+ use ApiClients \Foundation \Options as FoundationOptions ;
7+ use ApiClients \Foundation \Transport \Options as TransportOptions ;
8+ use ApiClients \Middleware \BearerAuthorization \BearerAuthorizationHeaderMiddleware ;
9+ use ApiClients \Middleware \BearerAuthorization \Options as BearerAuthorizationHeaderMiddlewareOptions ;
10+ use Lcobucci \JWT \Token ;
11+
12+ final class JWT implements AuthenticationInterface
13+ {
14+ /**
15+ * @var Token
16+ */
17+ private $ token ;
18+
19+ public function __construct (Token $ token )
20+ {
21+ $ this ->token = $ token ;
22+ }
23+
24+ public function getOptions (): array
25+ {
26+ return [
27+ FoundationOptions::TRANSPORT_OPTIONS => [
28+ TransportOptions::MIDDLEWARE => [
29+ BearerAuthorizationHeaderMiddleware::class,
30+ ],
31+ TransportOptions::DEFAULT_REQUEST_OPTIONS => [
32+ BearerAuthorizationHeaderMiddleware::class => [
33+ BearerAuthorizationHeaderMiddlewareOptions::TOKEN => $ this ->token ,
34+ ],
35+ ],
36+ ],
37+ ];
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments