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() |
||
42 | |||
43 | /** |
||
44 | * |
||
45 | * @return bool |
||
46 | */ |
||
47 | public function hasExpired() |
||
51 | |||
52 | /** |
||
53 | * Used to check age - may return null or a timestamp |
||
54 | * |
||
55 | * @return mixed null|timestamp when token was issued, if present |
||
56 | */ |
||
57 | public function getIssuedAt() |
||
61 | |||
62 | /** |
||
63 | * @return mixed null|timestamp |
||
64 | */ |
||
65 | public function getNotBefore() |
||
69 | |||
70 | /** |
||
71 | * Check for permission on a resource by the resource's ID |
||
72 | * |
||
73 | * @param string $id Resource Set ID - this should be the UUID generated by Keycloak for your resource |
||
74 | * @return bool |
||
75 | */ |
||
76 | 2 | public function hasResourceSetId($id) |
|
90 | |||
91 | /** |
||
92 | * Check for permission on a resource by the resource's name |
||
93 | * |
||
94 | * @param string $name Resource Set ID - this should be the name provided for the resource within Keycloak |
||
95 | * @return bool |
||
96 | */ |
||
97 | 2 | public function hasResourceSetName($name) |
|
111 | |||
112 | /** |
||
113 | * |
||
114 | * @return array List of resource ids |
||
115 | */ |
||
116 | 4 | public function listResourcesById() |
|
128 | |||
129 | /** |
||
130 | * |
||
131 | * @return array List of resource names |
||
132 | */ |
||
133 | 4 | public function listResourcesByName() |
|
145 | } |
||
146 |