apluslms / radar

Web service for analyzing program code similarity
4 stars 10 forks source link

Fix the loading of exercise templates now that they require JWT auth (in the gitmanager backend) #37

Closed markkuriekkinen closed 1 year ago

markkuriekkinen commented 2 years ago

Radar needs to load the exercise template (base code, skeleton code for the students in assignments) from the Git manager (since January 2022, A+ v1.12). Git manager requires JWT authentication for it. Implement the token in Radar.

The token was started in this commit: https://github.com/apluslms/radar/commit/bbda3f1d7c392893fd4b57fa9059418c2c79a642#diff-86a6d252027130bb3e9470141551defce99eb3a84d38ec135079baa05d42677d But the permissions were forgotten and the token does not yet work in production environments. Add the course instance READ permissions to the token. This requires the A+ course instance ID as a parameter.

I have started this fix, but I haven't finished it: https://github.com/Mankro/radar/commit/7c89b49212645726390402af561628a3ce547969

https://github.com/apluslms/radar/blob/5f911a3b199c436cbc46bbf2c95e02584e640fb6/provider/aplus.py#L82

        permissions = Permissions()
        permissions.instances.add(Permission.READ, id=1) #TODO A+ course instance id
        response = aplus_get(url, permissions=permissions, timeout=(4, 10))
markkuriekkinen commented 2 years ago

Note that the apluslms/run-radar Docker container requires small updates to the settings due to the JWT auth tokens. See #36

Radar connects to gitmanager in order to load the exercise template. Which server should have the settings APLUS_AUTH.TRUSTED_UIDS = radar...?

https://github.com/Mankro/radar/commits/wip-fix-jwt-container-and-memcached Sidenote, I also started to update the Memcached library since Radar has been using the deprecated library. Changing it in requirements.txt and the Django setttings.py should be trivial. https://github.com/Mankro/radar/commit/30d657e241bb4453aaa072ec31aa3a1d876108ff