@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | /** |
| 130 | 130 | * AES Key Wrap using 256-bit key |
| 131 | 131 | */ |
| 132 | - const A256KW= 'A256KW'; |
|
| 132 | + const A256KW = 'A256KW'; |
|
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Direct use of a shared symmetric key |
@@ -216,43 +216,41 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | const A256GCM = 'A256GCM'; |
| 218 | 218 | |
| 219 | - public static $header_location_alg = array |
|
| 220 | - ( |
|
| 219 | + public static $header_location_alg = array( |
|
| 221 | 220 | self::HS256, |
| 222 | 221 | self::HS384, |
| 223 | 222 | self::HS512, |
| 224 | 223 | self::RS256, |
| 225 | 224 | self::RS384, |
| 226 | 225 | self::RS512, |
| 227 | - self::ES256 , |
|
| 226 | + self::ES256, |
|
| 228 | 227 | self::ES384, |
| 229 | - self::ES512 , |
|
| 228 | + self::ES512, |
|
| 230 | 229 | self::PS256, |
| 231 | - self::PS384 , |
|
| 230 | + self::PS384, |
|
| 232 | 231 | self::PS512, |
| 233 | 232 | self::None, |
| 234 | 233 | self::RSA1_5, |
| 235 | - self::RSA_OAEP , |
|
| 234 | + self::RSA_OAEP, |
|
| 236 | 235 | self::RSA_OAEP_256, |
| 237 | - self::A128KW , |
|
| 236 | + self::A128KW, |
|
| 238 | 237 | self::A192KW, |
| 239 | 238 | self::A192KW, |
| 240 | 239 | self::A256KW, |
| 241 | 240 | self::Dir, |
| 242 | 241 | self::ECDH_ES, |
| 243 | - self::ECDH_ES_A128KW , |
|
| 242 | + self::ECDH_ES_A128KW, |
|
| 244 | 243 | self::ECDH_ES_A192KW, |
| 245 | - self::ECDH_ES_A256KW , |
|
| 246 | - self::A128GCMKW , |
|
| 244 | + self::ECDH_ES_A256KW, |
|
| 245 | + self::A128GCMKW, |
|
| 247 | 246 | self::A192GCMKW, |
| 248 | - self::A256GCMKW , |
|
| 249 | - self::PBES2_HS256_A128KW , |
|
| 247 | + self::A256GCMKW, |
|
| 248 | + self::PBES2_HS256_A128KW, |
|
| 250 | 249 | self::PBES2_HS384_A192KW, |
| 251 | 250 | self::PBES2_HS512_A256KW, |
| 252 | 251 | ); |
| 253 | 252 | |
| 254 | - public static $header_location_enc = array |
|
| 255 | - ( |
|
| 253 | + public static $header_location_enc = array( |
|
| 256 | 254 | self::A128CBC_HS256, |
| 257 | 255 | self::A192CBC_HS384, |
| 258 | 256 | self::A256CBC_HS512, |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $name |
| 45 | 45 | * @param JsonValue $value |
| 46 | 46 | */ |
| 47 | - public function __construct($name , $value){ |
|
| 47 | + public function __construct($name, $value) { |
|
| 48 | 48 | $this->name = $name; |
| 49 | 49 | $this->value = $value; |
| 50 | 50 | } |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - public function getName(){ |
|
| 56 | + public function getName() { |
|
| 57 | 57 | return $this->name; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @return JsonValue |
| 62 | 62 | */ |
| 63 | - public function getValue(){ |
|
| 63 | + public function getValue() { |
|
| 64 | 64 | return $this->value; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * @return array|bool|int|string|\utils\json_types\IJsonObject |
| 69 | 69 | */ |
| 70 | - public function getRawValue(){ |
|
| 70 | + public function getRawValue() { |
|
| 71 | 71 | return $this->getValue()->getValue(); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -105,9 +105,8 @@ discard block |
||
| 105 | 105 | * @var array |
| 106 | 106 | * @see jwt/impl/JWTClaimSet.php constructor |
| 107 | 107 | */ |
| 108 | - public static $registered_claim_set = array |
|
| 109 | - ( |
|
| 110 | - self::Issuer , |
|
| 108 | + public static $registered_claim_set = array( |
|
| 109 | + self::Issuer, |
|
| 111 | 110 | self::Subject, |
| 112 | 111 | self::Audience, |
| 113 | 112 | self::IssuedAt, |
@@ -119,8 +118,7 @@ discard block |
||
| 119 | 118 | /** |
| 120 | 119 | * @var array |
| 121 | 120 | */ |
| 122 | - public static $registered_claim_set_types = array |
|
| 123 | - ( |
|
| 121 | + public static $registered_claim_set_types = array( |
|
| 124 | 122 | self::Issuer => JsonTypes::StringOrURI, |
| 125 | 123 | self::Audience => JsonTypes::StringOrURI, |
| 126 | 124 | self::Subject => JsonTypes::StringOrURI, |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -91,9 +91,8 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function take() |
| 93 | 93 | { |
| 94 | - $payload = ($this->header->getType()->getString() === 'JWT') ? $this->claim_set : ''; |
|
| 95 | - return array |
|
| 96 | - ( |
|
| 94 | + $payload = ($this->header->getType()->getString() === 'JWT') ? $this->claim_set : ''; |
|
| 95 | + return array( |
|
| 97 | 96 | $this->header, |
| 98 | 97 | $payload, |
| 99 | 98 | $this->signature |
@@ -108,9 +107,9 @@ discard block |
||
| 108 | 107 | { |
| 109 | 108 | $now = new \DateTime(); |
| 110 | 109 | $exp = $this->getClaimSet()->getExpirationTime()->getDateTime(); |
| 111 | - if($exp < $now) return true; |
|
| 110 | + if ($exp < $now) return true; |
|
| 112 | 111 | $iat = $this->getClaimSet()->getIssuedAt()->getDateTime(); |
| 113 | - if($iat > $now) return true; |
|
| 112 | + if ($iat > $now) return true; |
|
| 114 | 113 | $diff = $now->getTimestamp() - $iat->getTimestamp(); |
| 115 | 114 | return $diff > $tolerance; |
| 116 | 115 | } |
@@ -108,9 +108,13 @@ |
||
| 108 | 108 | { |
| 109 | 109 | $now = new \DateTime(); |
| 110 | 110 | $exp = $this->getClaimSet()->getExpirationTime()->getDateTime(); |
| 111 | - if($exp < $now) return true; |
|
| 111 | + if($exp < $now) { |
|
| 112 | + return true; |
|
| 113 | + } |
|
| 112 | 114 | $iat = $this->getClaimSet()->getIssuedAt()->getDateTime(); |
| 113 | - if($iat > $now) return true; |
|
| 115 | + if($iat > $now) { |
|
| 116 | + return true; |
|
| 117 | + } |
|
| 114 | 118 | $diff = $now->getTimestamp() - $iat->getTimestamp(); |
| 115 | 119 | return $diff > $tolerance; |
| 116 | 120 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | * @param IJWTSnapshot $jwt_snapshot |
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - static public function serialize(IJWTSnapshot $jwt_snapshot){ |
|
| 34 | + static public function serialize(IJWTSnapshot $jwt_snapshot) { |
|
| 35 | 35 | list($header, $payload, $signature) = $jwt_snapshot->take(); |
| 36 | 36 | |
| 37 | 37 | $e_header = JOSEHeaderSerializer::serialize($header); |
| 38 | - $e_payload = ($header->getType()->getString() === 'JWT') ? JWTClaimSetSerializer::serialize($payload) : JWTRawSerializer::serialize($payload); |
|
| 38 | + $e_payload = ($header->getType()->getString() === 'JWT') ? JWTClaimSetSerializer::serialize($payload) : JWTRawSerializer::serialize($payload); |
|
| 39 | 39 | $e_signature = JWTRawSerializer::serialize($signature); |
| 40 | 40 | |
| 41 | 41 | return sprintf('%s.%s.%s', $e_header, $e_payload, $e_signature); |
@@ -46,18 +46,18 @@ discard block |
||
| 46 | 46 | * @return array |
| 47 | 47 | * @throws InvalidJWTException |
| 48 | 48 | */ |
| 49 | - static public function deserialize($input){ |
|
| 49 | + static public function deserialize($input) { |
|
| 50 | 50 | |
| 51 | 51 | $e_parts = explode(IBasicJWT::SegmentSeparator, $input); |
| 52 | 52 | |
| 53 | - if(count($e_parts) < 2) |
|
| 53 | + if (count($e_parts) < 2) |
|
| 54 | 54 | throw new InvalidJWTException(sprintf('%s has only 2 or less encoded parts!')); |
| 55 | 55 | $e_header = $e_parts[0]; |
| 56 | 56 | $e_payload = $e_parts[1]; |
| 57 | - $e_signature = count($e_parts)>2 ? $e_parts[2] : ''; |
|
| 57 | + $e_signature = count($e_parts) > 2 ? $e_parts[2] : ''; |
|
| 58 | 58 | $header = JOSEHeaderSerializer::deserialize($e_header); |
| 59 | 59 | $payload = ($header->getType()->getString() === 'JWT') ? JWTClaimSetSerializer::deserialize($e_payload) : JWTRawSerializer::deserialize($e_payload); |
| 60 | - $signature = !empty($e_signature) ? JWTRawSerializer::deserialize($e_signature): ''; |
|
| 60 | + $signature = !empty($e_signature) ? JWTRawSerializer::deserialize($e_signature) : ''; |
|
| 61 | 61 | return array($header, $payload, $signature); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | \ No newline at end of file |
@@ -50,8 +50,9 @@ |
||
| 50 | 50 | |
| 51 | 51 | $e_parts = explode(IBasicJWT::SegmentSeparator, $input); |
| 52 | 52 | |
| 53 | - if(count($e_parts) < 2) |
|
| 54 | - throw new InvalidJWTException(sprintf('%s has only 2 or less encoded parts!')); |
|
| 53 | + if(count($e_parts) < 2) { |
|
| 54 | + throw new InvalidJWTException(sprintf('%s has only 2 or less encoded parts!')); |
|
| 55 | + } |
|
| 55 | 56 | $e_header = $e_parts[0]; |
| 56 | 57 | $e_payload = $e_parts[1]; |
| 57 | 58 | $e_signature = count($e_parts)>2 ? $e_parts[2] : ''; |
@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | * @param JsonValue $id |
| 41 | 41 | * @param NumericDate $nbf |
| 42 | 42 | */ |
| 43 | - public function __construct |
|
| 44 | - ( |
|
| 43 | + public function __construct( |
|
| 45 | 44 | StringOrURI $issuer = null, |
| 46 | 45 | StringOrURI $subject = null, |
| 47 | 46 | StringOrURI $audience = null, |
@@ -135,7 +134,7 @@ discard block |
||
| 135 | 134 | public function getClaims() |
| 136 | 135 | { |
| 137 | 136 | $claims = array(); |
| 138 | - foreach($this->set as $k => $v) |
|
| 137 | + foreach ($this->set as $k => $v) |
|
| 139 | 138 | { |
| 140 | 139 | array_push($claims, new JWTClaim($k, $v)); |
| 141 | 140 | } |
@@ -260,7 +259,6 @@ discard block |
||
| 260 | 259 | public function getClaimByName($claim_name) |
| 261 | 260 | { |
| 262 | 261 | return isset($this->set[$claim_name]) ? |
| 263 | - $this->set[$claim_name] : |
|
| 264 | - null; |
|
| 262 | + $this->set[$claim_name] : null; |
|
| 265 | 263 | } |
| 266 | 264 | } |
| 267 | 265 | \ No newline at end of file |
@@ -123,8 +123,9 @@ |
||
| 123 | 123 | */ |
| 124 | 124 | public function addClaim(JWTClaim $claim) |
| 125 | 125 | { |
| 126 | - if (isset($this->set[$claim->getName()])) |
|
| 127 | - throw new ClaimAlreadyExistsException($claim->getName()); |
|
| 126 | + if (isset($this->set[$claim->getName()])) { |
|
| 127 | + throw new ClaimAlreadyExistsException($claim->getName()); |
|
| 128 | + } |
|
| 128 | 129 | |
| 129 | 130 | $this->set[$claim->getName()] = $claim->getValue(); |
| 130 | 131 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -33,8 +33,7 @@ discard block |
||
| 33 | 33 | * @param JsonValue|null $kid |
| 34 | 34 | * @param StringOrURI|null $cty |
| 35 | 35 | */ |
| 36 | - public function __construct |
|
| 37 | - ( |
|
| 36 | + public function __construct( |
|
| 38 | 37 | StringOrURI $alg, |
| 39 | 38 | StringOrURI $type = null, |
| 40 | 39 | JsonValue $kid = null, |
@@ -96,7 +95,7 @@ discard block |
||
| 96 | 95 | public function getHeaderByName($name) |
| 97 | 96 | { |
| 98 | 97 | $value = $this[$name]; |
| 99 | - if(is_null($value)) return null; |
|
| 98 | + if (is_null($value)) return null; |
|
| 100 | 99 | return new JOSEHeaderParam($name, $value); |
| 101 | 100 | } |
| 102 | 101 | } |
| 103 | 102 | \ No newline at end of file |
@@ -96,7 +96,9 @@ |
||
| 96 | 96 | public function getHeaderByName($name) |
| 97 | 97 | { |
| 98 | 98 | $value = $this[$name]; |
| 99 | - if(is_null($value)) return null; |
|
| 99 | + if(is_null($value)) { |
|
| 100 | + return null; |
|
| 101 | + } |
|
| 100 | 102 | return new JOSEHeaderParam($name, $value); |
| 101 | 103 | } |
| 102 | 104 | } |
| 103 | 105 | \ No newline at end of file |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -37,10 +37,8 @@ discard block |
||
| 37 | 37 | protected function __construct(IJWTClaimSet $claim_set) |
| 38 | 38 | { |
| 39 | 39 | |
| 40 | - parent::__construct |
|
| 41 | - ( |
|
| 42 | - new JOSEHeader |
|
| 43 | - ( |
|
| 40 | + parent::__construct( |
|
| 41 | + new JOSEHeader( |
|
| 44 | 42 | new StringOrURI('none'), |
| 45 | 43 | new StringOrURI('JWT') |
| 46 | 44 | ), |
@@ -75,7 +73,7 @@ discard block |
||
| 75 | 73 | { |
| 76 | 74 | list($header, $payload, $signature) = JWTSerializer::deserialize($compact_serialization); |
| 77 | 75 | |
| 78 | - if(!($payload instanceof IJWTClaimSet)) |
|
| 76 | + if (!($payload instanceof IJWTClaimSet)) |
|
| 79 | 77 | throw new \RuntimeException('Invalid payload type!'); |
| 80 | 78 | |
| 81 | 79 | $jwt = new UnsecuredJWT($payload); |
@@ -75,8 +75,9 @@ |
||
| 75 | 75 | { |
| 76 | 76 | list($header, $payload, $signature) = JWTSerializer::deserialize($compact_serialization); |
| 77 | 77 | |
| 78 | - if(!($payload instanceof IJWTClaimSet)) |
|
| 79 | - throw new \RuntimeException('Invalid payload type!'); |
|
| 78 | + if(!($payload instanceof IJWTClaimSet)) { |
|
| 79 | + throw new \RuntimeException('Invalid payload type!'); |
|
| 80 | + } |
|
| 80 | 81 | |
| 81 | 82 | $jwt = new UnsecuredJWT($payload); |
| 82 | 83 | $jwt->header = $header; |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param string $raw_input |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | - public static function serialize($raw_input){ |
|
| 24 | + public static function serialize($raw_input) { |
|
| 25 | 25 | $base64 = new Base64UrlRepresentation(); |
| 26 | 26 | return $base64->encode($raw_input); |
| 27 | 27 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $input |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public static function deserialize($input){ |
|
| 33 | + public static function deserialize($input) { |
|
| 34 | 34 | $base64 = new Base64UrlRepresentation(); |
| 35 | 35 | return $base64->decode($input); |
| 36 | 36 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Copyright 2015 OpenStack Foundation |
|
| 4 | - * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | - * you may not use this file except in compliance with the License. |
|
| 6 | - * You may obtain a copy of the License at |
|
| 7 | - * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | - * Unless required by applicable law or agreed to in writing, software |
|
| 9 | - * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | - * See the License for the specific language governing permissions and |
|
| 12 | - * limitations under the License. |
|
| 13 | - **/ |
|
| 3 | + * Copyright 2015 OpenStack Foundation |
|
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | + * you may not use this file except in compliance with the License. |
|
| 6 | + * You may obtain a copy of the License at |
|
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
|
| 8 | + * Unless required by applicable law or agreed to in writing, software |
|
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
|
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 11 | + * See the License for the specific language governing permissions and |
|
| 12 | + * limitations under the License. |
|
| 13 | + **/ |
|
| 14 | 14 | |
| 15 | 15 | namespace jwk; |
| 16 | 16 | |