@@ -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 jws; |
16 | 16 |
@@ -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 jws\payloads; |
16 | 16 |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | * @param mixed $content |
30 | 30 | * @return IJWSPayloadSpec |
31 | 31 | */ |
32 | - public static function build($content){ |
|
32 | + public static function build($content) { |
|
33 | 33 | |
34 | - if($content instanceof IJWTClaimSet){ |
|
34 | + if ($content instanceof IJWTClaimSet) { |
|
35 | 35 | return new _JWSPayloadClaimSetSpec($content); |
36 | 36 | } |
37 | - else{ |
|
37 | + else { |
|
38 | 38 | return new _JWSPayloadRawSpec($content); |
39 | 39 | } |
40 | 40 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * @param IJWTClaimSet $claim_set |
58 | 58 | */ |
59 | - public function __construct(IJWTClaimSet $claim_set){ |
|
59 | + public function __construct(IJWTClaimSet $claim_set) { |
|
60 | 60 | $this->claim_set = $claim_set; |
61 | 61 | } |
62 | 62 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $raw |
103 | 103 | */ |
104 | - public function __construct($raw){ |
|
104 | + public function __construct($raw) { |
|
105 | 105 | $this->raw = $raw; |
106 | 106 | } |
107 | 107 |
@@ -33,8 +33,7 @@ |
||
33 | 33 | |
34 | 34 | if($content instanceof IJWTClaimSet){ |
35 | 35 | return new _JWSPayloadClaimSetSpec($content); |
36 | - } |
|
37 | - else{ |
|
36 | + } else{ |
|
38 | 37 | return new _JWSPayloadRawSpec($content); |
39 | 38 | } |
40 | 39 | } |
@@ -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 jws\exceptions; |
16 | 16 |
@@ -72,5 +72,5 @@ |
||
72 | 72 | * @param string $signature |
73 | 73 | * @return IJWS |
74 | 74 | */ |
75 | - static public function fromHeaderClaimsAndSignature(IJOSEHeader $header, IJWSPayloadSpec $payload = null , $signature = ''); |
|
75 | + static public function fromHeaderClaimsAndSignature(IJOSEHeader $header, IJWSPayloadSpec $payload = null, $signature = ''); |
|
76 | 76 | } |
77 | 77 | \ 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 jws; |
16 | 16 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | public function invoke() |
31 | 31 | { |
32 | - if(func_num_args() <= 0) throw new \RuntimeException('you must pass len as arg!'); |
|
32 | + if (func_num_args() <= 0) throw new \RuntimeException('you must pass len as arg!'); |
|
33 | 33 | $byte_len = func_get_arg(0); |
34 | 34 | return ByteUtil::randomBytes($byte_len); |
35 | 35 | } |
@@ -29,7 +29,9 @@ |
||
29 | 29 | */ |
30 | 30 | public function invoke() |
31 | 31 | { |
32 | - if(func_num_args() <= 0) throw new \RuntimeException('you must pass len as arg!'); |
|
32 | + if(func_num_args() <= 0) { |
|
33 | + throw new \RuntimeException('you must pass len as arg!'); |
|
34 | + } |
|
33 | 35 | $byte_len = func_get_arg(0); |
34 | 36 | return ByteUtil::randomBytes($byte_len); |
35 | 37 | } |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | |
33 | 33 | private $services = array(); |
34 | 34 | |
35 | - private function __construct(){ |
|
35 | + private function __construct() { |
|
36 | 36 | |
37 | 37 | $this->services[self::RandomNumberGeneratorService] = new RandomNumberGeneratorService; |
38 | 38 | } |
39 | 39 | |
40 | - private function __clone(){} |
|
40 | + private function __clone() {} |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @return Utils_Registry |
44 | 44 | */ |
45 | - public static function getInstance(){ |
|
46 | - if(!is_object(self::$instance)){ |
|
45 | + public static function getInstance() { |
|
46 | + if (!is_object(self::$instance)) { |
|
47 | 47 | self::$instance = new Utils_Registry(); |
48 | 48 | } |
49 | 49 | return self::$instance; |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param string $service_name |
54 | 54 | * @return null|IService |
55 | 55 | */ |
56 | - public function get($service_name){ |
|
57 | - if(!array_key_exists($service_name, $this->services)) |
|
56 | + public function get($service_name) { |
|
57 | + if (!array_key_exists($service_name, $this->services)) |
|
58 | 58 | throw new \InvalidArgumentException('unknown service!'); |
59 | 59 | |
60 | 60 | return $this->services[$service_name]; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param IService $service |
66 | 66 | * @return $this |
67 | 67 | */ |
68 | - public function add($service_name, IService $service){ |
|
68 | + public function add($service_name, IService $service) { |
|
69 | 69 | $this->services[$service_name] = $service; |
70 | 70 | return $this; |
71 | 71 | } |
@@ -54,8 +54,9 @@ |
||
54 | 54 | * @return null|IService |
55 | 55 | */ |
56 | 56 | public function get($service_name){ |
57 | - if(!array_key_exists($service_name, $this->services)) |
|
58 | - throw new \InvalidArgumentException('unknown service!'); |
|
57 | + if(!array_key_exists($service_name, $this->services)) { |
|
58 | + throw new \InvalidArgumentException('unknown service!'); |
|
59 | + } |
|
59 | 60 | |
60 | 61 | return $this->services[$service_name]; |
61 | 62 | } |
@@ -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 utils\factories; |
16 | 16 |
@@ -42,18 +42,18 @@ |
||
42 | 42 | $segments = explode(IBasicJWT::SegmentSeparator, $compact_serialization); |
43 | 43 | // JWSs have three segments separated by two period ('.') characters. |
44 | 44 | // JWEs have five segments separated by four period ('.') characters. |
45 | - switch(count($segments)) |
|
45 | + switch (count($segments)) |
|
46 | 46 | { |
47 | 47 | case 3: |
48 | 48 | // JWS or unsecured one |
49 | 49 | $header = JOSEHeaderSerializer::deserialize($segments[0]); |
50 | - if($header->getAlgorithm()->getString() === 'none' && empty($segments[2])) |
|
50 | + if ($header->getAlgorithm()->getString() === 'none' && empty($segments[2])) |
|
51 | 51 | return UnsecuredJWT::fromCompactSerialization($compact_serialization); |
52 | - return JWSFactory::build( new JWS_CompactFormatSpecification($compact_serialization) ); |
|
52 | + return JWSFactory::build(new JWS_CompactFormatSpecification($compact_serialization)); |
|
53 | 53 | break; |
54 | 54 | case 5: |
55 | 55 | // JWE |
56 | - return JWEFactory::build( new JWE_CompactFormatSpecification($compact_serialization) ); |
|
56 | + return JWEFactory::build(new JWE_CompactFormatSpecification($compact_serialization)); |
|
57 | 57 | break; |
58 | 58 | default: |
59 | 59 | throw new InvalidCompactSerializationException; |
@@ -47,8 +47,9 @@ |
||
47 | 47 | case 3: |
48 | 48 | // JWS or unsecured one |
49 | 49 | $header = JOSEHeaderSerializer::deserialize($segments[0]); |
50 | - if($header->getAlgorithm()->getString() === 'none' && empty($segments[2])) |
|
51 | - return UnsecuredJWT::fromCompactSerialization($compact_serialization); |
|
50 | + if($header->getAlgorithm()->getString() === 'none' && empty($segments[2])) { |
|
51 | + return UnsecuredJWT::fromCompactSerialization($compact_serialization); |
|
52 | + } |
|
52 | 53 | return JWSFactory::build( new JWS_CompactFormatSpecification($compact_serialization) ); |
53 | 54 | break; |
54 | 55 | case 5: |
@@ -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 utils\exceptions; |
16 | 16 |