PluginProbe ʕ •ᴥ•ʔ
Wp Social Login and Register Social Counter / 2.2.4
Wp Social Login and Register Social Counter v2.2.4
trunk 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.2 1.3.3 1.3.4 1.3.6 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.4 1.4.5 1.4.6 1.4.8 1.4.9 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.8.0 1.8.1 1.8.2 1.8.3 1.8.5 1.8.6 1.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.8 2.2.9 3.0.0 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0
wp-social / lib / composer / vendor / firebase / php-jwt / README.md
wp-social / lib / composer / vendor / firebase / php-jwt Last commit date
src 5 years ago LICENSE 5 years ago README.md 5 years ago composer.json 5 years ago
README.md
214 lines
1 [](https://travis-ci.org/firebase/php-jwt![Build Status](https://travis-ci.org/firebase/php-jwt.png?branch=master)](https://travis-ci.org/firebase/php-jwt](https://travis-ci.org/firebase/php-jwt)
2 [](https://packagist.org/packages/firebase/php-jwt![Latest Stable Version](https://poser.pugx.org/firebase/php-jwt/v/stable)](https://packagist.org/packages/firebase/php-jwt](https://packagist.org/packages/firebase/php-jwt)
3 [](https://packagist.org/packages/firebase/php-jwt![Total Downloads](https://poser.pugx.org/firebase/php-jwt/downloads)](https://packagist.org/packages/firebase/php-jwt](https://packagist.org/packages/firebase/php-jwt)
4 [](https://packagist.org/packages/firebase/php-jwt![License](https://poser.pugx.org/firebase/php-jwt/license)](https://packagist.org/packages/firebase/php-jwt](https://packagist.org/packages/firebase/php-jwt)
5
6 PHP-JWT
7 =======
8 A simple library to encode and decode JSON Web Tokens (JWT) in PHP, conforming to [](https://tools.ietf.org/html/rfc7519RFC 7519](https://tools.ietf.org/html/rfc7519](https://tools.ietf.org/html/rfc7519).
9
10 Installation
11 ------------
12
13 Use composer to manage your dependencies and download PHP-JWT:
14
15 ```bash
16 composer require firebase/php-jwt
17 ```
18
19 Example
20 -------
21 ```php
22 <?php
23 use \Firebase\JWT\JWT;
24
25 $key = "example_key";
26 $payload = array(
27 "iss" => "http://example.org",
28 "aud" => "http://example.com",
29 "iat" => 1356999524,
30 "nbf" => 1357000000
31 );
32
33 /**
34 * IMPORTANT:
35 * You must specify supported algorithms for your application. See
36 * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40
37 * for a list of spec-compliant algorithms.
38 */
39 $jwt = JWT::encode($payload, $key);
40 $decoded = JWT::decode($jwt, $key, array('HS256'));
41
42 print_r($decoded);
43
44 /*
45 NOTE: This will now be an object instead of an associative array. To get
46 an associative array, you will need to cast it as such:
47 */
48
49 $decoded_array = (array) $decoded;
50
51 /**
52 * You can add a leeway to account for when there is a clock skew times between
53 * the signing and verifying servers. It is recommended that this leeway should
54 * not be bigger than a few minutes.
55 *
56 * Source: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#nbfDef
57 */
58 JWT::$leeway = 60; // $leeway in seconds
59 $decoded = JWT::decode($jwt, $key, array('HS256'));
60
61 ?>
62 ```
63 Example with RS256 (openssl)
64 ----------------------------
65 ```php
66 <?php
67 use \Firebase\JWT\JWT;
68
69 $privateKey = <<<EOD
70 -----BEGIN RSA PRIVATE KEY-----
71 MIICXAIBAAKBgQC8kGa1pSjbSYZVebtTRBLxBz5H4i2p/llLCrEeQhta5kaQu/Rn
72 vuER4W8oDH3+3iuIYW4VQAzyqFpwuzjkDI+17t5t0tyazyZ8JXw+KgXTxldMPEL9
73 5+qVhgXvwtihXC1c5oGbRlEDvDF6Sa53rcFVsYJ4ehde/zUxo6UvS7UrBQIDAQAB
74 AoGAb/MXV46XxCFRxNuB8LyAtmLDgi/xRnTAlMHjSACddwkyKem8//8eZtw9fzxz
75 bWZ/1/doQOuHBGYZU8aDzzj59FZ78dyzNFoF91hbvZKkg+6wGyd/LrGVEB+Xre0J
76 Nil0GReM2AHDNZUYRv+HYJPIOrB0CRczLQsgFJ8K6aAD6F0CQQDzbpjYdx10qgK1
77 cP59UHiHjPZYC0loEsk7s+hUmT3QHerAQJMZWC11Qrn2N+ybwwNblDKv+s5qgMQ5
78 5tNoQ9IfAkEAxkyffU6ythpg/H0Ixe1I2rd0GbF05biIzO/i77Det3n4YsJVlDck
79 ZkcvY3SK2iRIL4c9yY6hlIhs+K9wXTtGWwJBAO9Dskl48mO7woPR9uD22jDpNSwe
80 k90OMepTjzSvlhjbfuPN1IdhqvSJTDychRwn1kIJ7LQZgQ8fVz9OCFZ/6qMCQGOb
81 qaGwHmUK6xzpUbbacnYrIM6nLSkXgOAwv7XXCojvY614ILTK3iXiLBOxPu5Eu13k
82 eUz9sHyD6vkgZzjtxXECQAkp4Xerf5TGfQXGXhxIX52yH+N2LtujCdkQZjXAsGdm
83 B2zNzvrlgRmgBrklMTrMYgm1NPcW+bRLGcwgW2PTvNM=
84 -----END RSA PRIVATE KEY-----
85 EOD;
86
87 $publicKey = <<<EOD
88 -----BEGIN PUBLIC KEY-----
89 MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8kGa1pSjbSYZVebtTRBLxBz5H
90 4i2p/llLCrEeQhta5kaQu/RnvuER4W8oDH3+3iuIYW4VQAzyqFpwuzjkDI+17t5t
91 0tyazyZ8JXw+KgXTxldMPEL95+qVhgXvwtihXC1c5oGbRlEDvDF6Sa53rcFVsYJ4
92 ehde/zUxo6UvS7UrBQIDAQAB
93 -----END PUBLIC KEY-----
94 EOD;
95
96 $payload = array(
97 "iss" => "example.org",
98 "aud" => "example.com",
99 "iat" => 1356999524,
100 "nbf" => 1357000000
101 );
102
103 $jwt = JWT::encode($payload, $privateKey, 'RS256');
104 echo "Encode:\n" . print_r($jwt, true) . "\n";
105
106 $decoded = JWT::decode($jwt, $publicKey, array('RS256'));
107
108 /*
109 NOTE: This will now be an object instead of an associative array. To get
110 an associative array, you will need to cast it as such:
111 */
112
113 $decoded_array = (array) $decoded;
114 echo "Decode:\n" . print_r($decoded_array, true) . "\n";
115 ?>
116 ```
117
118 Using JWKs
119 ----------
120
121 ```php
122 // Set of keys. The "keys" key is required. For example, the JSON response to
123 // this endpoint: https://www.gstatic.com/iap/verify/public_key-jwk
124 $jwks = ['keys' => []];
125
126 // JWK::parseKeySet($jwks) returns an associative array of **kid** to private
127 // key. Pass this as the second parameter to JWT::decode.
128 JWT::decode($payload, JWK::parseKeySet($jwks), $supportedAlgorithm);
129 ```
130
131 Changelog
132 ---------
133
134 #### 5.0.0 / 2017-06-26
135 - Support RS384 and RS512.
136 See [#117](https://github.com/firebase/php-jwt/pull/117). Thanks [@joostfaassen](https://github.com/joostfaassen)!
137 - Add an example for RS256 openssl.
138 See [#125](https://github.com/firebase/php-jwt/pull/125). Thanks [@akeeman](https://github.com/akeeman)!
139 - Detect invalid Base64 encoding in signature.
140 See [#162](https://github.com/firebase/php-jwt/pull/162). Thanks [@psignoret](https://github.com/psignoret)!
141 - Update `JWT::verify` to handle OpenSSL errors.
142 See [#159](https://github.com/firebase/php-jwt/pull/159). Thanks [@bshaffer](https://github.com/bshaffer)!
143 - Add `array` type hinting to `decode` method
144 See [#101](https://github.com/firebase/php-jwt/pull/101). Thanks [@hywak](https://github.com/hywak)!
145 - Add all JSON error types.
146 See [#110](https://github.com/firebase/php-jwt/pull/110). Thanks [@gbalduzzi](https://github.com/gbalduzzi)!
147 - Bugfix 'kid' not in given key list.
148 See [#129](https://github.com/firebase/php-jwt/pull/129). Thanks [@stampycode](https://github.com/stampycode)!
149 - Miscellaneous cleanup, documentation and test fixes.
150 See [#107](https://github.com/firebase/php-jwt/pull/107), [#115](https://github.com/firebase/php-jwt/pull/115),
151 [#160](https://github.com/firebase/php-jwt/pull/160), [#161](https://github.com/firebase/php-jwt/pull/161), and
152 [#165](https://github.com/firebase/php-jwt/pull/165). Thanks [@akeeman](https://github.com/akeeman),
153 [@chinedufn](https://github.com/chinedufn), and [@bshaffer](https://github.com/bshaffer)!
154
155 #### 4.0.0 / 2016-07-17
156 - Add support for late static binding. See [#88](https://github.com/firebase/php-jwt/pull/88) for details. Thanks to [@chappy84](https://github.com/chappy84)!
157 - Use static `$timestamp` instead of `time()` to improve unit testing. See [#93](https://github.com/firebase/php-jwt/pull/93) for details. Thanks to [@josephmcdermott](https://github.com/josephmcdermott)!
158 - Fixes to exceptions classes. See [#81](https://github.com/firebase/php-jwt/pull/81) for details. Thanks to [@Maks3w](https://github.com/Maks3w)!
159 - Fixes to PHPDoc. See [#76](https://github.com/firebase/php-jwt/pull/76) for details. Thanks to [@akeeman](https://github.com/akeeman)!
160
161 #### 3.0.0 / 2015-07-22
162 - Minimum PHP version updated from `5.2.0` to `5.3.0`.
163 - Add `\Firebase\JWT` namespace. See
164 [#59](https://github.com/firebase/php-jwt/pull/59) for details. Thanks to
165 [@Dashron](https://github.com/Dashron)!
166 - Require a non-empty key to decode and verify a JWT. See
167 [#60](https://github.com/firebase/php-jwt/pull/60) for details. Thanks to
168 [@sjones608](https://github.com/sjones608)!
169 - Cleaner documentation blocks in the code. See
170 [#62](https://github.com/firebase/php-jwt/pull/62) for details. Thanks to
171 [@johanderuijter](https://github.com/johanderuijter)!
172
173 #### 2.2.0 / 2015-06-22
174 - Add support for adding custom, optional JWT headers to `JWT::encode()`. See
175 [#53](https://github.com/firebase/php-jwt/pull/53/files) for details. Thanks to
176 [@mcocaro](https://github.com/mcocaro)!
177
178 #### 2.1.0 / 2015-05-20
179 - Add support for adding a leeway to `JWT:decode()` that accounts for clock skew
180 between signing and verifying entities. Thanks to [@lcabral](https://github.com/lcabral)!
181 - Add support for passing an object implementing the `ArrayAccess` interface for
182 `$keys` argument in `JWT::decode()`. Thanks to [@aztech-dev](https://github.com/aztech-dev)!
183
184 #### 2.0.0 / 2015-04-01
185 - **Note**: It is strongly recommended that you update to > v2.0.0 to address
186 known security vulnerabilities in prior versions when both symmetric and
187 asymmetric keys are used together.
188 - Update signature for `JWT::decode(...)` to require an array of supported
189 algorithms to use when verifying token signatures.
190
191
192 Tests
193 -----
194 Run the tests using phpunit:
195
196 ```bash
197 $ pear install PHPUnit
198 $ phpunit --configuration phpunit.xml.dist
199 PHPUnit 3.7.10 by Sebastian Bergmann.
200 .....
201 Time: 0 seconds, Memory: 2.50Mb
202 OK (5 tests, 5 assertions)
203 ```
204
205 New Lines in private keys
206 -----
207
208 If your private key contains `\n` characters, be sure to wrap it in double quotes `""`
209 and not single quotes `''` in order to properly interpret the escaped characters.
210
211 License
212 -------
213 [](http://opensource.org/licenses/BSD-3-Clause3-Clause BSD](http://opensource.org/licenses/BSD-3-Clause](http://opensource.org/licenses/BSD-3-Clause).
214