|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace JoseJwt\Context; |
|
4
|
|
|
|
|
5
|
|
|
use JoseJwt\Json\JsonMapper; |
|
6
|
|
|
use JoseJwt\Jwe\JweAlgorithmCollection; |
|
7
|
|
|
use JoseJwt\Jwe\JweEncryptionCollection; |
|
8
|
|
|
use JoseJwt\Jws\JwsAlgorithmCollection; |
|
9
|
|
|
|
|
10
|
|
|
class DefaultContext implements Context |
|
11
|
|
|
{ |
|
12
|
|
|
/** @var JsonMapper|null */ |
|
13
|
|
|
private $jsonMapper; |
|
14
|
|
|
|
|
15
|
|
|
/** @var JwsAlgorithmCollection */ |
|
16
|
|
|
private $jwsAlgorithms; |
|
17
|
|
|
|
|
18
|
|
|
/** @var JweAlgorithmCollection */ |
|
19
|
|
|
private $jweAlgorithms; |
|
20
|
|
|
|
|
21
|
|
|
/** @var JweEncryptionCollection */ |
|
22
|
|
|
private $jweEncryptions; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
*/ |
|
26
|
|
|
public function __construct() |
|
27
|
|
|
{ |
|
28
|
|
|
$this->jwsAlgorithms = new JwsAlgorithmCollection(); |
|
29
|
|
|
$this->jweAlgorithms = new JweAlgorithmCollection(); |
|
30
|
|
|
$this->jweEncryptions = new JweEncryptionCollection(); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @return JsonMapper|null |
|
35
|
|
|
*/ |
|
36
|
|
|
public function jsonMapper() |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->jsonMapper; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return JwsAlgorithmCollection |
|
43
|
|
|
*/ |
|
44
|
|
|
public function jwsAlgorithms() |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->jwsAlgorithms; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return JweAlgorithmCollection |
|
51
|
|
|
*/ |
|
52
|
|
|
public function jweAlgorithms() |
|
53
|
|
|
{ |
|
54
|
|
|
return $this->jweAlgorithms; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return JweEncryptionCollection |
|
59
|
|
|
*/ |
|
60
|
|
|
public function jweEncryptions() |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->jweEncryptions; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param JsonMapper|null $jsonMapper |
|
67
|
|
|
* |
|
68
|
|
|
* @return DefaultContext |
|
69
|
|
|
*/ |
|
70
|
|
|
public function setJsonMapper(JsonMapper $jsonMapper = null) |
|
71
|
|
|
{ |
|
72
|
|
|
$this->jsonMapper = $jsonMapper; |
|
73
|
|
|
|
|
74
|
|
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|