Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use API endpoint for UW Middleware #16

Closed
Tracked by #19
ymdahi opened this issue Jun 19, 2024 · 0 comments · Fixed by #19
Closed
Tracked by #19

Use API endpoint for UW Middleware #16

ymdahi opened this issue Jun 19, 2024 · 0 comments · Fixed by #19

Comments

@ymdahi
Copy link

ymdahi commented Jun 19, 2024

Endpoint URL for this client will be:

https://www.serverurl.com/api/1.0/users/roles/unit_id/get/key/{{PUBLIC_KEY}}/hash/{{PRIVATE_KEY_HASHED}}/format/json/unit_id/{{OrgUnitId}}/

PUBLIC_KEY and PRIVATE_KEY will come from key module and lms sync module settings.

Hashed version of private key to be used in endpoint like so: $hashed_key = hash('sha256', $private_key . 'json');

So the request might look like this:

// $this->endpoint_url = 'https://www.serverurl.com/api/1.0/users/roles/unit_id/get/key/';
// $pub_key = $this->repository->getKey($this->endpoint_publickey)->getKeyValue();
// $priv_key = $this->repository->getKey($this->endpoint_privatekey)->getKeyValue();
// $hashed_key = hash('sha256', $private_key . 'json');

$request = $client->get($this->endpoint_url . $priv_key . '/hash/' . $hashed_key . '/format/json/unit_id/' . $group_id;

// outputs something like this: https://www.serverurl.com/api/1.0/users/roles/unit_id/get/key/66a294130e3bfbd744f7c275b2899e429acc78e6a0406a2ce696fc9f37ecebd7/hash/a1913ff83f9c32b0f4b3f1dc36f30977c16788cacad9a643acc72e77840b533f/format/json/unit_id/1017765/
ymdahi pushed a commit that referenced this issue Jun 21, 2024
@ymdahi ymdahi mentioned this issue Jun 21, 2024
6 tasks
@ymdahi ymdahi linked a pull request Jun 21, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant