1 | <?php |
||
24 | class KeycloakRoles |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * @var array a list of roles associated with the realm |
||
29 | */ |
||
30 | protected $realmAccess = []; |
||
31 | /** |
||
32 | * @var array An associative array of KeycloakResourceRoles keyed by resource name |
||
33 | */ |
||
34 | protected $resourcesAndRoles = []; |
||
35 | |||
36 | /** |
||
37 | * KeycloakRoles constructor. |
||
38 | * |
||
39 | * Will decode the JWT access token hidden within this OAuth `AccessToken` yielding additional information |
||
40 | * provided by KeyCloak. |
||
41 | * |
||
42 | */ |
||
43 | 6 | public function __construct($obj) |
|
59 | |||
60 | /** |
||
61 | * |
||
62 | * @param AccessToken $accessToken The token received within which the `access_token` exists (yes, really) |
||
63 | * @param string $encryptionKey For signature checking purposes |
||
64 | * @param string $encryptionAlgorithm For signature checking purposes |
||
65 | * @return KeycloakRoles |
||
66 | */ |
||
67 | public static function fromToken(AccessToken $accessToken, $encryptionKey, $encryptionAlgorithm) { |
||
71 | |||
72 | public function hasResourceNamed($name) { |
||
78 | |||
79 | public function hasRealmRoleNamed($name) { |
||
85 | |||
86 | /** |
||
87 | * @param $name |
||
88 | * @return KeyCloakResourceRoles |
||
89 | */ |
||
90 | 2 | public function getRolesOfResourceNamed($name) { |
|
93 | } |