1 | <?php |
||
18 | class KeycloakEntitlements |
||
19 | { |
||
20 | |||
21 | private $data; |
||
22 | |||
23 | /** |
||
24 | * KeycloakEntitlements constructor. |
||
25 | * @param object $resultOfJwtDecode |
||
26 | */ |
||
27 | 4 | public function __construct($resultOfJwtDecode) |
|
31 | |||
32 | /** |
||
33 | * Basic checks should there be data that can be examined. |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function isValid() { |
||
41 | |||
42 | /** |
||
43 | * |
||
44 | * @return bool |
||
45 | */ |
||
46 | public function hasExpired() { |
||
49 | |||
50 | /** |
||
51 | * Used to check age - may return null or a timestamp |
||
52 | * |
||
53 | * @return mixed null|timestamp when token was issued, if present |
||
54 | */ |
||
55 | public function getIssuedAt() { |
||
58 | |||
59 | /** |
||
60 | * @return mixed null|timestamp |
||
61 | */ |
||
62 | public function getNotBefore() { |
||
65 | |||
66 | /** |
||
67 | * Check for permission on a resource by the resource's ID |
||
68 | * |
||
69 | * @param string $id Resource Set ID - this should be the UUID generated by Keycloak for your resource |
||
70 | * @return bool |
||
71 | */ |
||
72 | 2 | public function hasResourceSetId($id) { |
|
85 | |||
86 | /** |
||
87 | * Check for permission on a resource by the resource's name |
||
88 | * |
||
89 | * @param string $name Resource Set ID - this should be the name provided for the resource within Keycloak |
||
90 | * @return bool |
||
91 | */ |
||
92 | 2 | public function hasResourceSetName($name) { |
|
105 | |||
106 | /** |
||
107 | * |
||
108 | * @return array List of resource ids |
||
109 | */ |
||
110 | 4 | public function listResourcesById() { |
|
121 | |||
122 | /** |
||
123 | * |
||
124 | * @return array List of resource names |
||
125 | */ |
||
126 | 4 | public function listResourcesByName() { |
|
137 | } |